Re: "From" in mail() header problem.
| From: | Chris | Date: | Wed, 18 May 2005 14:45:54 +0000 |
| Subject: | Re: "From" in mail() header problem. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215480@lists.php.net to get a copy of this message | ||
Rahul S. Johari wrote:
Ave, I¹ve written a simple script to send a mail out in HTML format to the recipient. Everything is working fine... Except the ³From² header. The recipient receives the email from ³World Wide Web Server <www@mydomain.com>² instead of what I have specified. Here¹s my code... <FORM action="<?php echo $PHP_SELF; ?>" method="post" name="one"><TEXTAREA name="desc" cols="20" rows="5"></TEXTAREA><INPUT name="Submit" type="submit" value="Submit"></FORM> <? if($Submit) { $to = "myemail@something.com"; $subject = "SOMETHING : File Upload Notification"; $message = " <html><head></head> <body> Hi, <br><br> You have recieved a new file in the Something File Manager, with the following details: <br><br> Name: One<br> Size: 94685 Bytes<br> Description: $desc<br> Date: $now <br><br> Please visit <b>SOMETHING File Manager</a></b> to login to your account and download the file.<br> This is an automated notification email. Please do not reply to this email. <br><br> Regards,<br> SOMETHING<br> </body></html> "; $message = stripslashes($message); mail($to,$subject,$message,'Content-type: text/html; charset=iso-8859-1; From: SOMETHING <something@something.com>; Reply-To: myemail@something.com; MIME-Version: 1.0; X-Mailer: PHP/' . phpversion()); echo "It is done"; } ?> Those should not be separated by semicolons (;) , you should use \r\n. So...mail($to,$subject,$message,"Content-type: text/html\r\ncharset=iso-8859-1\r\nFrom: SOMETHING <something@something.com>\r\nReply-To: myemail@something.com\r\nMIME-Version: 1.0\r\nX-Mailer: PHP/" . phpversion()); echo "It is done";
... I don¹t know what I¹m doing wrong, it¹s not reading the FROM or Reply-TO in the headers. Instead of the mail stating ³Something <something@something.com>² at the recipient¹s end, it is stating ³World Wide Web Server <www@mydomain.com>² .. I have no clue why. Thanks, Rahul S. Johari Coordinator, Internet & Administration Informed Marketing Services Inc. 251 River Street Troy, NY 12180 Tel: (518) 266-0909 x154 Fax: (518) 266-0909 Email: rahul@informed-sources.com http://www.informed-sources.com