note 46486 added to function.mail
| From: | tbellefy at yahoo dot com | Date: | Wed, 13 Oct 2004 02:18:50 +0000 |
| Subject: | note 46486 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78463@lists.php.net to get a copy of this message | ||
Hello all,
I have a simple solution to some of the larger email companies(Y!, Hotmail etc..) rejecting your
emails sent from a php script:
First thing I did was identify the default "Return-Path:" header which in my case was
www@mydomain.com. This is obviusly set by my hosting company and I had no control over it. Every
email I sent from this address was being automatically added to the bulk folder.
I tried using the -f switch but still ended up in the bulk folder because it would generate a
X-Authentication-Warning header.
I had to edit /etc/mail/submit.cf on my server and add www as a trusted user.
Here are the lines to look for in your submit.cf file:
#####################
# Trusted users #
#####################
# this is equivalent to setting class "t"
#Ft/etc/mail/trusted-users
Troot
Tdaemon
Tuucp
Tmailnull
Twww <-- notice the addition of the www user.
Now I can use the -f switch freely and all emails are getting accepted in the inbox!
Snippet:
<?php
mail($to, $subject, $message, $headers, "-f".$return_path."");
?>
Good Luck!
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46486
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46486&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46486&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46486&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46486&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46486&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46486&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46486&report=yes
Search -- http://master.php.net/manage/user-notes.php