i am using phpmailer and i am getting following error:
Message was not sent
Mailer Error: SMTP Error: Could not connect to SMTP host.
<?php
require("class.phpmailer.php");
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'ssl://smtp.myhost.com:465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'myemail@myhost.com';
$mailer->Password = 'mypass';
$mailer->From = 'myemailagain@myhost.com';
$mailer->FromName = 'myname';
$email1 = $_GET['email'];
$verification = rand();
$mailer->Body = 'Welcome to our site';
$mailer->Subject = 'verification';
$mailer->AddAddress($email1);
if(!$mailer->Send())
{
echo "Message was not sent<br/ >";
echo "Mailer Error: " . $mailer->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>
note: i use “myhost.com” but it’s not my real domain
I believe you are specifying your host incorrectly. Try this instead:
If it still doesn’t work, consider setting:
Also, make sure PHP’s OpenSSL extension is enabled.