0

MY PHPMailer email goes to Spam for YahooMail and Hotmail, but not for Gmail. After running Port25's authentication verifier test to make sure my email settings were good these were the summary of the results:

Summary of Authentication Verifier - SPF check: pass - DomainKeys check:neutral - DKIM check:neutral - SpamAssassin check: ham (Message me if you want the full details)

WHAT I'VE TRIED:

  • SMTPAUTH = TRUE
  • DOMAIN NOT BLACKLISTED: voozlr.com
  • Authentication Verifier Test Passed
  • REMOVED ALL IMAGES
  • REMOVED ALL CONTENT EXCEPT FOR BODY: TEST

I'm hosting my site and email server on Interserver.net, and they made sure everything is working from their end, but I still go to SPAM.

So what are the best practices for my PHP code to avoid the spam folder? Someone please give me an example code or better yet edit my code to show me what SPAM free PHPMAILER code looks like.

PHP CODE:

$mail2 = new PHPMailer();
$mail2->IsMail();
$mail2->Host = "mail.mydomain.com"; 
$mail2->CharSet  = "UTF-8";
$mail2->SMTPAuth = true; 
$mail2->Username = "name@mydomain.com"; 
$mail2->Password = "password1234"; 
$mail2->SMTPSecure = 'TLS';                      
$mail2->Port = 25;                             
$mail2->setFrom('support@mydomain.com', 'Support');
$mail2->AddAddress("$email");
$mail2->AddReplyTo('support@mydomain.com');
$mail2->WordWrap = 50;

mail($to, $subject, $message, $headers);

$mail2->Subject = "Testing";

$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
$headers = "From: " . strip_tags($_POST['admin@mydomain.com']) . "\r\n";
"Reply-To: support@mydomain" . "\r\n";

$message .= 'test';
$mail2->Body = $message;
$mail2->AltBody = $message;

if(!$mail2->Send())
{
echo "Message could not be sent. Please reload the page and try again. <p>";
echo "Mailer Error: " . $mail2->ErrorInfo;
exit;
}
ChosenJuan
  • 891
  • 3
  • 26
  • 56
  • This code is a mess. Make up your mind whether you want to use `mail` or PHPMailer - don't use both at once. Base your code on the examples provided with PHPMailer, don't change random settings to made up values. As for the spam problem, that's probably down to your content, DNS config and past sending reputation. – Synchro Jun 29 '17 at 20:46
  • What content? I just removed all my content and tested it with body and subject as Test. My past sending reputation which is just confirmation emails btw, should be good, since I'm not blacklisted anywhere. My DNS configuration is good since I passed the auth verification test or is there some other way to check? As for the code, I'm a beginner at PHP and PHP Mailer so if you got a good examples of how I can fix this mess by all means go ahead: – ChosenJuan Jun 29 '17 at 20:53
  • 1
    It takes months of sending thousands of messages a day, and having those messages actively marked as not spam by recipients to be able to deliver to inboxes reliably; many ISPs deliver to spam by default. It's difficult and unfair, but that's the situation. As for your code, start again with one of the examples from PHPMailer- it will be quicker than fixing what you have. Don't change config settings unless you know why - for example, your setting for `SMTPSecure` is wrong. – Synchro Jun 29 '17 at 21:02

0 Answers0