note 45758 added to function.mail
| From: | webmaster at ogmiosproject dot org | Date: | Fri, 17 Sep 2004 13:06:18 +0000 |
| Subject: | note 45758 added to function.mail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76877@lists.php.net to get a copy of this message | ||
I have encountered some problems using both the "to" parameter of the mail() function and
filling in the "To: " field in the header.
I don't know if this is due to my PHP version (4.3.8) or my e-mail program (Microsoft Outlook
9.0.0.2814) which doesn't read the SMTP message it recieves properly.
Anyway, to avoid this, I simply do not fill in the "to" paramter and leave the header to
do all the wotk:
<?php
$headers = "MIME-Version: 1.0\\r\\n" .
"Content-type: text/html; charset=WINDOWS-1255\\r\\n" .
"To: Some Target <target@somemail.com>\\r\\n" .
"From: Some Source <source@somemail.com>\\r\\n";
$message = "Hello World";
$subject = "Some Subject";
mail(null, $subject, $message, $headers);
?>
Hope this helps someone.
----
Manual Page -- http://www.php.net/manual/en/function.mail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45758
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45758&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45758&report=yes
Search -- http://master.php.net/manage/user-notes.php