note 59449 rejected from function.mail by betz
| From: | betz@php.net | Date: | Wed, 07 Dec 2005 11:21:41 +0000 |
| Subject: | note 59449 rejected from function.mail by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-99688@lists.php.net to get a copy of this message | ||
Note Submitter: mysterix at mail dot ru
----
I have been using mail() in my PHP scripts OK, until my hosting company suddenly disabled sending
mail from the 'nobody' user (though PHP scripts are still running under this user). They
say they somehow fight spam this way... Anyway, while surfing on this issue, I found out lots of
people came across the same.
The suggested solutions were:
1. Try sending e-mails with the additional -f parameter for sendmail, like:
<?php
mail($email, $subject, $message, $headers, '-f webmaster@yoursite.com');
?>
I tried this and this didn't work for me.
2. Try setting the ini option "sendmail_from" before sending (which is an alternative to
the above solution).
<?php
ini_set('sendmail_from','webmaster@yoursite.com');
mail($email, $subject, $message, $headers);
?>
I tried this and this didn't work for me either.
3. If you govern your server and it is Apache, you can install phpsuexec (own site, http://www.phpsuexec.com, under construction now) or suPHP
(http://www.suPHP.org) module so PHP scripts run under the respective hosting user instead of
nobody.
This was not an option for me because I only own a single hosting account and cannot force the
hosting company install either module.
4. Get some class like phpMailer (http://phpmailer.sourceforge.net/) and have it send your mail
through SMTP.
I think I will stop at this one. Please comment if anyone has better ideas.