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 <[EMAIL PROTECTED]>²
instead of what I have specified. Hereıs my code...


[snip]
$message = stripslashes($message);
mail($to,$subject,$message,'Content-type: text/html; charset=iso-8859-1;
From: SOMETHING <[EMAIL PROTECTED]>; Reply-To: [EMAIL PROTECTED];
MIME-Version: 1.0; X-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
<[EMAIL PROTECTED]>² at the recipientıs end, it is stating ³World Wide
Web Server <[EMAIL PROTECTED]>² .. I have no clue why.

What happens if you do it like this:

$headers  = "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: SOMETHING <[EMAIL PROTECTED]>\r\n";
$headers .= "Reply-To: [EMAIL PROTECTED]";
$headers .= "MIME-Version: 1.0; X-Mailer: PHP/' . phpversion() . "\r\n";

mail($to,$subject,$message,$headers);

From the manual:

----
additional_headers (optional)

String to be inserted at the end of the email header.

This is typically used to add extra headers (From, Cc, and Bcc).
Multiple extra headers should be separated with a CRLF (\r\n).

Note: If messages are not received, try using a LF (\n) only.
Some poor quality Unix mail transfer agents replace LF by CRLF
automatically (which leads to doubling CR if CRLF is used). This should
be a last resort, as it does not comply with RFC 2822. ----




Failing that, I'd check with the admin of your server.  Maybe they are
re-writing all outbound email with the *real* From header regardless of
what you put in there.

-philip
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to