I'm new in Php and find a Php mailer class to send email but getting following error.
Error Message:
Message was not sent.Mailer error: SMTP connect() failed.
Php Code:
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.impeccableplus.com"; // SMTP server
$mail->From = "from@example.com";
$mail->AddAddress("email@gmail.com");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>
Thanks.
Update:
I just change the host name = localhost. Now it's successfully sent email but problem is, It's showing the mail in spam folder. Why ?