RE: From address in mail() header not working - ideas?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'd recommend trying to put the from at the beginning of your headers and check the result. Also I'd verify that $name and $orderResult['email'] contains the data I expect. :-)

<>< Ryan

-----Original Message-----
From: Aaron Wolski [mailto:aaronjw@martekbiz.com]
Sent: Thursday, October 24, 2002 1:13 PM
To: php-db@lists.php.net
Subject:  From address in mail() header not working - ideas? 


Sorry for the <OFFTOPIC> post all but I am really stuck to get this
done.
 
I can't for the life figure this out.

I have a from header set in one piece of code that gets emailed to the
merchant. Here si the code:

$to = "$merchant_email"; 
$subject = "New Order on Rinkrake.com";
$long_date = date("r",time()); 
$headers = "Date: $long_date\r\n";  
$headers .= "To: $to\r\n"; 
$headers .= "X-Mailer: SOME MAIL SERVER\r\n"; 
$headers = "Return-Path: <$support_email>\r\n";

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/mixed;
boundary=\"Message-Boundary\"\r\n";
$headers .= "Content-transfer-encoding: 7BIT\r\n";
$headers .= "X-attachments: $attach_name\r\n";
$headers .= "--Message-Boundary\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-transfer-encoding: 7BIT\r\n";
$headers .= "$message\r\n";
$headers .= "\n\n--Message-Boundary\r\n";
$headers .= "Content-type: $attach_type; name=\"$attach_name\"\r\n";
$headers .= "Content-Transfer-Encoding: BASE64\r\n";
$headers .= "Content-disposition: attachment;
filename=\"$attach_name\"\n\r\n";
$headers .= "$encoded_attach\r\n";
$headers .= "--Message-Boundary--\r\n";
$headers .= "From: $name <".$orderResult['email'].">\r\n";

mail($to, "$subject", "", $headers);
 
 
 
The above ALL works except the From header. What I get is the email
account of the web user username <username@domainname.com>


Now... I have another piece of code that I send to the customer (not the
merchant) that looks like this:

 
$headers = "Return-Path: <$support_email>\r\n";

$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: The RinkRake <$merchant_email>\r\n";


mail ($orderResult["email"],"Your Order on Rinkrake.com", $message,
$headers);

 
This piece of code comes through with NO "from" problems. Its formatted
as it should be.

Does anyone have any thoughts?

Are there only so many headers I can use which is why it doesn't come
through in the first one?

Thanks all.

Aaron

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux