Hullo, I have been browsing through the internet on how best I can send an email from my website; and it seems like most were directing me to PHPMailer.
I added the php mailer folder onto my server, and now am attempting to test whether am email can really be sent. However, I keep getting this error message;
Message was not sent.Mailer error: The following From address failed: sample_mail@gmail.com : Called Mail() without being connected;
Here i sthe code I am using to send the email;
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->From = "samle1@gmail.com";
$mail->AddAddress("sample2@rocketmail.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.';
}
?>
Can someone help me out on how to solve that error?