[thelist] PHP mail() - message format

Chris Blessing webguy at mail.rit.edu
Wed Nov 28 14:30:31 CST 2001


Are you using this in a *nix environment? You may have better luck using
popen() to connect to sendmail if you are.  We use a rather old-school
method of sending confirmation emails for subscriptions by doing this:

$mail="/usr/lib/sendmail -t";
$fd=popen($mail,"w");
fputs($fd,"To: you at youraddress.com\n");
fputs($fd,"From: me at mycompany.com\n");
fputs($fd,"Subject: bleh\n");
fputs($fd,"Thank you for subscribing, blah blah blah\n");
fputs($fd,"Thank you for subscribing again, blah blah blah");
pclose($fd);

If you're on a non-*nix machine you'll need to have some sort of local mail
application to launch in order to use popen().

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Bill Haenel
> Sent: Wednesday, November 28, 2001 3:18 PM
> To: thelist
> Subject: [thelist] PHP mail() - message format
>
>
> I'm using the PHP mail() function to send text submitted by form.
>
> Mail messages are arriving formatted correctly (with line breaks) through
> some accounts, and not formatted correctly (without line breaks) through
> others. (Mail is text format)
>
> I'm sure it's due to certain mail servers not handling \n or \r or
> something, but I'm not sure what to replace with what or even if that's
> correct. I've already tried this...
>
> 	$message = ereg_replace("(\n|\r)", "\r\n", $message);
>
> ...before sending it with mail(), but that made no difference.
>
> I've also tried setting a header for Content-Type.
>
> Thanks -
>
> BH
>
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list