note 59449 added to function.mail
| From: | mysterix at mail dot ru | Date: | Wed, 07 Dec 2005 07:56:45 +0000 |
| Subject: | note 59449 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-99672@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+59449
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59449&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+59449&report=yes
Search -- http://master.php.net/manage/user-notes.php