I am attempting to send emails using phpMailer and GMail SMTP. It works fine sending emails to other Gmail accounts but sending to Yahoo the mail never gets there. I read about debugging using ip addresses and such, but I am not skilled in that area?
here is the code:
$mail->Mailer='smtp';
try {
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "__email__"; // GMAIL username
$mail->Password = "__pass__"; // GMAIL password
$mail->SMTPDebug = 2;
$a = md5(uniqid(rand(), true)); //create a unique validation code
//These are the variables for the email
$mail->AddAddress (trim($_POST['email']),trim($_POST['username'])); // this is the email address collected form the form
$mail->Subject = "Registration"; // Subject
$mail->Body = "Thank you for registering\n your security code is ".$a;
$mail->Send();
echo "check your email to complete registration";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
$mail->ClearAddresses();
update: Found the problem: Our server had been blacklisted by Yahoo (not my fault) so that's a day-and-a-half wasted.