I want to try sending email of my web application from localhost. I am using SMTP Gmail. I am installing to my computer an SMTP server to send out mail with this one. My syntax in my controller like below:
Yii::import('application.extensions.PHPMailer.JPhpMailer');
$mail = new JPhpMailer;
$mail->IsSMTP();
$mail->Host = 'smpt.gmail.com:';
$mail->Posrt = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 'myGmailAccount';
$mail->Password = 'myPassword';
$mail->SetFrom('$to', '$name');
$mail->Subject = 'PHPMailer Test Subject via smtp, basic with authentication';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
$mail->MsgHTML('<h1>JUST A TEST!</h1>');
//$mail->AddAddress('');
$mail->Send();
But an error happen :
SMTP -> ERROR: Failed to connect to server: The requested address is not valid in its context. (10049) SMTP Error: Could not connect to SMTP host.
How to fix it?