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 Link to comment 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? Link to comment 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.