0
I’m making a website where the customer registers his email and when registering he will automatically receive an email with a newsletter.
To send this email I am using Phpmailer
<?php
require 'PHPMailer/PHPMailerAutoload.php';
$email = $_POST['email'];
$Mailer = new PHPMailer();
//Define que será usado SMTP
$Mailer->IsSMTP();
//Enviar e-mail em HTML
$Mailer->isHTML(true);
//Aceitar carasteres especiais
$Mailer->Charset = 'UTF-8';
//Configurações
$Mailer->SMTPAuth = true;
$Mailer->SMTPSecure = 'tls';
//nome do servidor
$Mailer->Host = 'servidor.com.br';
//Porta de saida de e-mail
$Mailer->Port = 30;
//Dados do e-mail de saida - autenticação
$Mailer->Username = '[email protected]';
$Mailer->Password = 'MinhaSenha';
//E-mail remetente (deve ser o mesmo de quem fez a autenticação)
$Mailer->From = '[email protected]';
//Nome do Remetente
$Mailer->FromName = utf8_decode('Agência');
//Assunto da mensagem
$Mailer->Subject = utf8_decode('Seja bem-vindo');
//Corpo da Mensagem
$Mailer->Body = utf8_decode('<div style="background-color:#e6f8fe;">
<!--[if gte mso 9]>
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
<v:fill type="tile" src="http://agencia306.com.br/blog-306/img/como-aproximar/1.jpg" color="#e6f8fe"/>
</v:background>
<![endif]-->
<table height="100%" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="top" align="left" background="http://agencia306.com.br/blog-306/img/como-aproximar/1.jpg"> <h1>Em fase de construção </h1> </td>
</tr>
</table>
</div>');
//Corpo da mensagem em texto
$Mailer->AltBody = 'conteudo do E-mail em texto';
//Destinatario
$Mailer->AddAddress($email);
if($Mailer->Send()){
echo "<script>alert('E-mail enviado com sucesso');history.back();</script>";
}else{
echo "<script>alert('Erro no envio do e-mail: " . $Mailer->ErrorInfo . " ');history.back();</script>";
}
?>
The code is working smoothly, the email arrives smoothly for the person who signs up. But I’m having two problems:
1° Problem: Sending this way, I test in my Yahoo email, the email goes without problem. But the main goal is to send a background image and text on top of that image is not working. It’s just going text.
2° Problem: Going to Span. I researched about and read that using Phpmailer this wasn’t going to happen. But it’s going to Span.
Hello Carlos, thank you very much. I’m having a lot of doubts about the background URL. Because I put it this way you said it. I used the html background. But it’s still not working. I saw in your example background="background_image.png" you only used the image name. No need to enter its location??
– Wess
Yes, it needs to be the full url and host the image somewhere. In the case of tools like Mailchimp, you can already climb through the tool itself and it hosts this image for you.
– Karl Zillner
The best part of the answer: "You also need to have a lot of faith :)" :p
– Cobra
kkkkkkkkkk but it’s true...spam is a boring business and varies a lot from server to server that is receiving the email. Turns and moves has user complaining that did not receive.
– Karl Zillner
Do you have any tutorial to use this Mailchimp, please? Pq just put the full url not working.
– Wess
With this Mailchimp I add in my codes?? Pq site is being made in pure code, no platform like wordpress.
– Wess
@Wess youtube has a lot of videos explaining how to move Mailchimp and Mailchimp itself is very intuitive. It has an area to upload images and such. Like you’re trying to?
– Karl Zillner
Thank you very much Carlos. I actually tried in other ways here without using Mailchimp. But thank you very much, what you went through helped me a lot. I tried the method you passed using the html background, but even calling the whole url, when the email arrives, the background image does not appear.
– Wess
But in question, from appearing in spam I did the processes you went through and thank God, I believe that now this quiet. Thank you very much
– Wess