note 39730 added to function.mail
| From: | Derek at rn2 dot php dot net | Date: | Mon, 09 Feb 2004 03:03:49 +0000 |
| Subject: | note 39730 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64858@lists.php.net to get a copy of this message | ||
I had the problem that when sending "large" emails (at least 1000 characters), the mail
function would add exclamation characters "!" into the body of the email.
This was easily fixed by adding a wordwrap to the body of the email. The following function will do
this for you:
<?php
function send_mail($myname, $myemail, $contactname, $contactemail, $subject, $message, $bcc) {
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: \"".$myname."\" <".$myemail.">\n";
if ($bcc != "")
$headers .= "Bcc: ".$bcc."\n";
$output = $message; $output = wordwrap($output, 72);
return(mail("\"".$contactname."\"
<".$contactemail.">", $subject, $output, $headers));
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39730
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39730&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39730&report=yes
Search -- http://master.php.net/manage/user-notes.php