note 25576 deleted from ref.mail by kennyt
| From: | kennyt@php.net | Date: | Sun, 18 Jul 2004 17:44:18 +0000 |
| Subject: | note 25576 deleted from ref.mail by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73544@lists.php.net to get a copy of this message | ||
Note Submitter: pvlasenko@hotmail.com.com
----
If you find your self struggling with mail() function like I was you might want to send mail
directly from your mailer and not through the mail() function. I was having hard time sending
long(registration confirmation) messages with simple mail() function on Linux. My solution...
// Configuration
$announce_subject = "Message From Our Web Site";
$announce_from_email = "editor@somesite.com";
$announce_from_name = "Our Site";
$announce_to_email = "listaddr@listhost.com";
$body = "Announcement. Our site has a special offer today. Please visit. Thank you.";
$MP = "/usr/sbin/sendmail -t";
$spec_envelope = 1;
// Access Sendmail
// Conditionally match envelope address
if($spec_envelope)
{
$MP .= " -f $announce_from_email";
}
$fd = popen($MP,"w");
fputs($fd, "To: $announce_to_email\n");
fputs($fd, "From: $announce_from_name <$announce_from_email>\n");
fputs($fd, "Subject: $announce_subject\n");
fputs($fd, "X-Mailer: PHP4\n");
fputs($fd, $body);
pclose($fd);
Hope this helps you.
Pavel Vlasenko