Reputation: 1155
I am trying to send email from my website to my godaddy mail and zoho mail but its not working. I tried it on my gmail account and its working fine. I am using phpmailer. MY CODE-
require_once "PHPMailerAutoload.php";
//PHPMailer Object
$mail = new PHPMailer;
//From email address and name
$mail->From = "[email protected]";
$mail->FromName = "Himanshu Mishra";
$mail->addAddress("my godaddy webmail"); //Recipient name is optional
//Send HTML or Plain Text email
$mail->isHTML(true);
$mail->Subject = "Subject Text";
$mail->Body = "<i>Mail body in HTML</i>";
$mail->AltBody = "This is the plain text version of the email content";
if(!$mail->send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent successfully";
}
Please help!!!!!
Upvotes: 1
Views: 532
Reputation: 3485
Your From
syntax is wrong
Instead of
$mail->From = "[email protected]";
$mail->FromName = "Himanshu Mishra";
It should be
$mail->setFrom('[email protected]', 'Himanshu Mishra');
Check this link https://github.com/PHPMailer/PHPMailer
Upvotes: 1