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 "kyle@gator616.hostgator.com", 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: webmaster@example.com' . "\r\n" .

    'Reply-To: webmaster@example.com' . "\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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.