I'm trying to send emails using phpmailer but every mail that i sended, finish in the spam folder.
This is the code
require("phpmailer/class.phpmailer.php"); // or wherever you put phpmail.class
$username="xxx";
$password="yyy";
$mail = new PHPMailer;
$mail->isMail();
$mail->IsHTML(true);
$mail->SMTPDebug = 4;
$mail->setFrom('news@lexvirtual.cl', 'Lexvirtual');
$mail->addAddress("roasdf@gmail.com", "hola");
$mail->Subject = 'Nueva postulación lexvirtual.cl';
$mail->AddEmbeddedImage('../assets/img/common/lexvirtual_logo.png', 'logoimg', '../assets/img/common/lexvirtual_logo.png');
$body = file_get_contents('email_templates/register.php');
$body = str_replace('%username%', $username, $body);
$body = str_replace('%password%', $password, $body);
$message = $body;
$mail->msgHTML($message);
if ($mail->send()) {
echo "email enviado";
} else {
echo "email no enviado";
}
I'm sending the email from my domain that is lexvirtual (the same domain that i'm using to send the email (news@lexvirtual.cl)).
Now i'm using a template using html but when i send a email using only text, still send the email to spam. I tried reading other questions about this problem,but still can't fix the issue.
Someone can help me please?