Mavent Posted August 19, 2011 Share Posted August 19, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/245243-mail-not-delivered-after-setting-headers-in-with-php-mail-command/ Share on other sites More sharing options...
xyph Posted August 19, 2011 Share Posted August 19, 2011 Check SPAM filters. If the source server domain differs from that in the From: header, stricter filters will catch that. Quote Link to comment https://forums.phpfreaks.com/topic/245243-mail-not-delivered-after-setting-headers-in-with-php-mail-command/#findComment-1259601 Share on other sites More sharing options...
Mavent Posted August 19, 2011 Author Share Posted August 19, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/245243-mail-not-delivered-after-setting-headers-in-with-php-mail-command/#findComment-1259609 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.