I am 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'm 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 running smoothly, email arrives smoothly for the person who signs up. But I have two problems:
1 ° Problem: Sending this way, I test in my Yahoo email, the email goes without problem. But the main purpose of sending a background image and text over that image is not working. This is just going text.
2nd Problem: You are going to Span. I researched and read that using PhpMailer this was not going to happen. But it's going to Span.