The important line was $mail->SMTPAuth = true.
Thanks to:
http://www.fasthostinghelp.com/send-mail-using-phpmailer-t98.html$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "mail.domain name"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "Domain Email account"; // SMTP username
$mail->Password = "password of an email account"; // SMTP password
$mail->From = "From email account – from above mentioned domain";
$mail->FromName = "From Name here";
$mail->AddAddress("To Email account here ","Display name");
$mail->AddReplyTo("Reply to email account here ","Details");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Subject Line of the email";
$mail->Body = "Body part of the message – email details</b>";
$mail->AltBody = "Alternate part of the body";
if(!$mail->Send())
{
echo "Message did not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
No comments:
Post a Comment