note 25576 added to ref.mail

From: Date: Sat, 28 Sep 2002 20:04:24 +0000
Subject: note 25576 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-37371@lists.php.net to get a copy of this message
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 -- http://www.php.net/manual/en/ref.mail.php http://master.php.net/manage/user-notes.php?action=edit+25576 http://master.php.net/manage/user-notes.php?action=delete+25576 http://master.php.net/manage/user-notes.php?action=reject+25576

« previous php.notes (#37371) next »