Jump to content

Mail not delivered after setting Headers in with .php mail(); command


Mavent

Recommended Posts

Hola all;

I'm trying to send an email from a form.  And succeeding.  :)  However, the mail always shows as coming from "[email protected]", which I'd really prefer it not do.  (Obviously, I'm using hostgator as my host.)

 

Here's the code that works:

mail($myemail, $subject, $message);

 

If I use that, the mail gets sent, albeit with the wrong From.

 

So, I did this:

 

$headers = 'From: [email protected]' . "\r\n" .

    'Reply-To: [email protected]' . "\r\n" .

    'X-Mailer: PHP/' . phpversion();

 

mail($to, $subject, $message, $headers);

 

...and it no longer sends the Email.  Or at very least, the mail never arrives at the location it's being sent.  I'm not really sure where it's breaking, because it behaves in all other ways exactly like the other version, except no mail ever arrives at the target address.

 

Note: the address I'm trying to use as my From is my admin address for my top level domain.

Check SPAM filters. If the source server domain differs from that in the From: header, stricter filters will catch that.

 

Well dip me in honey and toss me to the lesbians.  This turned out to be exactly what happened.  It never occurred to me that this would even be possible- it's basically mail from the same email account that got tossed into the Spam folder.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.