I'm getting an invalid address
error while running the PHP script below. The SMTP credentials and recipient e-mail were altered for this post. They are all valid on the actual script. I don't know why the recipient e-mail is being rejected. I'm trying to send an e-mail with SMTP authentication, and SMTP security (SSL, TLS) is not required.
Any help would be appreciated.
include 'PHPMailer_5.2.2/class.phpmailer.php';
function SendConfirmation ($sName, $sEmail)
{
$mail = new PHPMailer ();
$mail->SMTPDebug = 2;
$mail->Host = "mail.exchange.telus.com";
$mail->IsSMTP ();
$mail->Username = "inbin@website.com";
$mail->Password = "password";
$mail->From = "inbin@website.com";
$mail->FromName = "Web Site";
$mail->AddAddress ($sEmail, $sName);
$mail->Subject = 'PHPMailer Test' . date ('Y-m-d H:i:s');
$mail->Body = "This is a test.";
if ($mail->Send ())
echo "
Mail sent.";
else
echo "
Mail not sent. " . $mail->ErrorInfo;
echo "
";
}
/***[ Main ] **************************************************************************/
$sName = 'Johan Cyprich';
$sEmail = 'jcyprich@website.com';
$bSent = SendConfirmation ($sName, $sEmail);