Zicsus
Zicsus

Reputation: 1155

Unable to send email from godaddy server to godaddy or zoho mail

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

Answers (1)

Amit Ray
Amit Ray

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

Related Questions