RE: [PHP] PHP Send Mail Main headers.
| From: | Don Read | Date: | Mon, 24 Mar 2003 10:35:21 +0000 |
| Subject: | RE: [PHP] PHP Send Mail Main headers. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140820@lists.php.net to get a copy of this message | ||
On 24-Mar-2003 Philip J. Newman wrote:
> $headers .= "MIME-Version: 1.0\r\n";
> $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
> $headers .= "From: ".$from_name." <".$from_address.">\r\n";
> $headers .= "Reply-To: ".$from_name."
> <".$from_address.">\r\n";
> $headers .= "X-Priority: 3\r\n";
> $headers .= "X-MSMail-Priority: Normal\r\n";
> $headers .= "X-Mailer: iCEx Networks HTML-Mailer v1.0";
>
> Is this about all i need to send a mail in PHP excluding the mail();
>
>
More than enough.
Couple of thoughts ...
Drop the X-Priority and X-MSMail-Priority. Those are the default values
and thus un-necessary.
Also the <crlf> is over kill; a simple \n will do just fine.
----
The way I usually do it:
$adminemail='Foobaz Administration <blah@foobarbaz.com>';
$theprgmr='<myaccount@myhome.com>';
$headers =array(
'List-Id' => SITENAME,
'Cc' => "$adminemail, <bob@work.com>",
'Sender' => "$adminemail",
'Reply-To' => "$adminemail",
'Bcc' => "$theprgmr",
'From' => "$adminemail"
);
$mailhdrs='';
foreach($headers as $k => $v) {
$mailhdrs .=sprintf("%s: %s\n", $k, $v);
}
mail($mailto, $mailsubj, $mailmsg, $mailhdrs);
>
> ------
> Philip J. Newman.
> Head Developer
> info@philipnz.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Oh, and I hope you're going to consider a multipart/alternative message
body. HTML-only e-mail is evil.
Regards,
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.