Hi,
I wanted to try PHP's mail functionality, basically if I could send emails using GMAIL's SMTP server, in the same way I do it using Thunderbird (a mail program, similar to Outlook Express, but much better .
As GMAIL requires a secure connection, it seems I can't use mail and have to use PHPMailer instead.
So I installed it and configured it, but when I try to send an email I get the following error:
"Mailer Error: The following From address failed: <my email address>"
The configuration is exactly as that of Thunderbird, but here it is so you can take a look at it:
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // send via SMTP
$mail->Host = "smtp.gmail.com"; // SMTP servers
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "<MY EMAIL ADDRESS>"; // SMTP username
$mail->Password = "<MY PASSWORD>"; // SMTP password
$mail->Port = 587;
$mail->From = "<MY EMAIL ADDRESS>";
$mail->FromName = "<MY EMAIL ADDRESS>";
$mail->AddAddress("<RECIPIENT'S EMAIL ADDRESS>","User");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the <b>HTML body</b>";
$mail->AltBody = "This is the text-only body";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
Anyone came accross this problem before and was able to overcome it? Many thanks,
Javier