note 23261 deleted from function.mail by sniper
| From: | sniper@php.net | Date: | Wed, 29 Jan 2003 12:40:03 +0000 |
| Subject: | note 23261 deleted from function.mail by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43055@lists.php.net to get a copy of this message | ||
I can for some unknown reason not send e-mail from PHP with qmail. No error message or anything. My
workaround is the following function which is a drop-in for mail().
function qmail($to, $subject, $message, $header) {
$email = "To: $to\n"
//you could use ini_get("sendmail_from") for this address
//or if you omit it qmail will insert user@domain
. "From: sender@somewhere\n"
. "Subject: $subject\n"
. rtrim($header) . "\n\n"
. $message;
if ($filepointer = popen(ini_get("sendmail_path"), w)) {
fputs($filepointer, $email, strlen($email));
pclose($filepointer);
} else {
//an error occured
}
}
//example usage :
qmail("reciever@somewhere", "Hello!", "How are you?", "");
I hope this can be of use to someone.
I'm using PHP 4.2.1 as a Apache 2 filter together with qmail 1.03 on Linux.
/Max Landborn