eskimopest Posted July 10, 2017 Share Posted July 10, 2017 I've working on a script to send emails with phpmailer and everything works fine but on a live server, goes to spam. This is my code: // SEND EMAIL CODE include('vendor/PHPMailerAutoload.php'); include('vendor/class.smtp.php'); $email = new PHPMailer(); $email->IsSMTP(); $email->SMTPAuth = true; $email->SMTPKeepAlive = true; $email->Host = 'hostname'; $email->Port = 465; $email->Username = 'my_username@host.com'; $email->Password = 'my_pass'; $email->SMTPSecure = 'ssl'; $email->setFrom('my_email@host.com', 'name'); $email->addReplyTo('my_email@host.com', 'name'); $email->Subject = $subject; $email->Body = $message; // set the emails to send the message foreach($emails_to as $mail) { $email->addAddress($mail); } // send the email if(!$email->Send()) { echo "Message was not sent <br />PHPMailer Error: " . $email->ErrorInfo; } else { echo "Message has been sent"; } $mail->clearAddresses(); $mail->clearAttachments(); What am i doing wrong? could it be that the name of setFrom() is not set properly?Please help. Tks in advance Quote Link to comment https://forums.phpfreaks.com/topic/304287-phpmailer-going-to-spam/ Share on other sites More sharing options...
requinix Posted July 10, 2017 Share Posted July 10, 2017 Simply using PHPMailer does not mean your emails will go through. You have to find out why it went to spam. Does the From address not match the actual sender address? Did the email fail SPF validation? Does the email look spammy? Quote Link to comment https://forums.phpfreaks.com/topic/304287-phpmailer-going-to-spam/#findComment-1548175 Share on other sites More sharing options...
Jacques1 Posted July 10, 2017 Share Posted July 10, 2017 Also, whose SMTP server are you're using? Your own? Then you should double-check the configuration of the server itself and check if the IP address is on any of the common blacklists (Spamhaus etc.) due to prior abuse. Quote Link to comment https://forums.phpfreaks.com/topic/304287-phpmailer-going-to-spam/#findComment-1548176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.