My entire PHPMailer mail setup is as follows-:
<?php
require_once('mailer/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = "<html><head></head><body>
<strong>This is a System generated message. PLEASE DO NOT REPLY TO THIS MAIL.</strong>
<br />
Click on the following ling to activate your account-:
<br />
<a href='http://www.google.co.in'>Click Here !! </a>
<br />
END OF MESSAGE.
</body></html>";
//$body = preg_replace("[\]i",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$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 = "foobar@gmail.com"; // GMAIL username
$mail->Password = "foobar"; // GMAIL password
$mail->SetFrom("iembcarocks@gmail.com", "India Indigenous");
$mail->AddReplyTo("iembcarocks@gmail.com", "India Indigenous");
$mail->Subject = "India Indigenous Account Activation";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "alexde989@yahoo.com";
$mail->AddAddress($address);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>domail</title>
</head>
<body>
</body>
</html>
The above configuration works fine for Gmail mails but I can't send mails to Yahoo. Do I have to change the "$mail->Host " parameter to the Yahoo SMTP ?? It is set to Gmail SMTP.