note 48512 added to function.mail
| From: | brent at nirus dot net | Date: | Mon, 27 Dec 2004 19:44:10 +0000 |
| Subject: | note 48512 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-82353@lists.php.net to get a copy of this message | ||
To solve my \r\n problem using Windows server 2003 and Alt-N Daemon For mail server on same system.
All I had to do was first make sure that I could relay and send without authentication on my LAN or
127.0.0.1. Then:
// this sends the correct headers to the mail server
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
//But the entire $message was still on one line with no carraige returns so...
$message = str_replace(Chr(13), "<br>", $message);
mail(mymail@domain.com, $subject, $message, $headers);
Also, I was trying to get all the mail that was sent into a database. I was using the following to
prevent SQL injection... this is not good for the mail headers! So If you are wanting to use the
real escape then specify this after you send mail or give the variable another name
$subject=mysql_real_escape_string($_POST['subject']);
- Brent Russell
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+48512
Delete -- http://master.php.net/manage/user-notes.php?action=delete+48512&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48512&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48512&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48512&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48512&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48512&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+48512&report=yes
Search -- http://master.php.net/manage/user-notes.php