Sending mail using phpMailer via Gmail
Posted: Mon Sep 19, 2005 5:40 am
Anyone know how to send a mail using phpMailer via Gmail ?
Running this on my PC returns Failed : The following From address failed: username@gmail.com.
Thanks
Code: Select all
include_once("class.phpmailer.php");
$body = "test";
$text_body = "test";
$mail = new PHPMailer();
$mail->Username = "username@gmail.com";
$mail->Password = "password";
$mail->From = "username@gmail.com";
$mail->FromName = "Someone";
$mail->Host = "smtp.gmail.com:587";
$mail->Mailer = "smtp";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress("someone@somedomain.com", "Someone Else");
$mail->IsSMTP();
if (!$mail->Send())
echo 'Failed : '.$mail->ErrorInfo;Thanks