Jump to content

Recommended Posts

Hi

 

We have recently moved servers and now I have noticed that the mail is not sending

 

basic email is as follows

$sendEmailTo  = "[email protected]";
$MailSubject    = "Contact Information";
$MailHeaders = "";
$MailBodyTxt = "This is the body";
$MailHeaders .= 'MIME-Version:1.0'."\r\n";
$MailHeaders .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$MailHeaders .= 'To: [email protected]'."\r\n";
$MailHeaders .= 'From: [email protected]'."\r\n";
$MailHeaders .= 'Reply-To: Jamie <[email protected]>'."\r\n";

if(mail($sendEmailTo, $MailSubject, $MailBodyTxt, $MailHeaders)){
    echo "Mail Sent";
}else{
    echo "Error";   
}

 

Above fails, if I comment out the header line 'From:.... then it fails, any suggestions or ideas

 

(PHP V 5.2.12, any other info required, give us a shout)

Link to comment
https://forums.phpfreaks.com/topic/201721-mail-fails-with-from-header/
Share on other sites

Did you make a typo in the original question? You state in the title that it fails with 'From' header, you then go on to state that it fails if you take it out...

 

Assuming it works with it commented out, does it actually 'Fail' i.e. output "Error" or are you just not receiving the e-mail and it actually outputs "Mail Sent"?

I dont see any malformation in the header From: line (although I will assume the address is an exepler) perticularly if the Reply-To is working without a problem.  What seems most likely is that the SMTP server has MX record send restrictions (i.e. if the IP address the mail is coming from does not resolve to the same global IP address as the domain MX record used in the From header it will treat it as spam.)

 

have you tried setting error_reporting(E_ALL) at the top of the page to see if it will show anything new?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.