Im trying to send an email on localhost(wamp) but it gives me the error on top!
I also tried with 'tls' and port 587 but same error
my email is configured to receive insecure connection and Imap option is activated ..
pls help me , I need this for school project
$mailto = $_POST['mail_to'];
$mailSub = $_POST['mail_sub'];
$mailMsg = $_POST['mail_msg'];
require 'PHPMailer-master/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail ->IsSmtp();
$mail ->SMTPDebug = 2;
$mail ->SMTPAuth = true;
$mail ->SMTPSecure = 'ssl';
$mail ->Host = "smtp.gmail.com";
$mail ->Port = 465; /* or 587;*/
$mail ->IsHTML(true);
$mail ->Username = "xxxxx";
$mail ->Password = "xxxxx";
$mail ->SetFrom("xxxxx");
$mail ->Subject = $mailSub;
$mail ->Body = $mailMsg;
$mail ->AddAddress($mailto);
if(!$mail->Send())
{
echo "Mail Not Sent";
}
else
{
echo "Mail Sent";
}
?>
No comments:
Post a Comment