Forum Moderators: coopster

Message Too Old, No Replies

Troubleshooting PHP formmail

         

momsbudget

2:58 am on Apr 23, 2007 (gmt 0)

10+ Year Member



I am having an issue with this code, and let's see if I can explain it. The script sends orders to a faxing system, as well as copies to certain people. All of the orders are going through, with the correct from/reply/return headers, except for the main one that goes to the fax system. That e-mail simply pulls from the server instead of the correct from address and thus it won't send the fax since the system doesn't recognize the registered email account. This is my first time using PHP, so it's been fun learning, but this is driving me nuts!

function sendOrder() {
session_start();
global $config;
if(strlen($_SESSION['INTERFAXEMAIL']) > 0) {
$header .= "From: $_SESSION[INTERFAXEMAIL]
\n";
$header .= "Return-Path: info@url.com\n";
$header .= "Reply-To: info@url.com\n";
$header .= "MIME-Version: 1.0\n";
$header .= "Content-Transfer-Encoding: 8bit\n";
$header .= "Content-Type: text/html; charset=\"iso-8859-1\"";
ini_set("form_email",$_SESSION['INTERFAXEMAIL']);
$faxhtml = $this->FaxHtml();
mail($_SESSION['INTERFAX']."@url.tc","ORDER: $_SESSION[NAME]","URL",$faxhtml,$header);
mail($_SESSION['ContactEmail'],"ORDER: $_SESSION[NAME]",$faxhtml,$header);
mail($config->order_copy_email_addr,"ORDER: $_SESSION[NAME]",$faxhtml,$header);
session_destroy();
$this->html .= "<div id='order_sent'>Your order is being sent to $_SESSION[NAME]. If you have a question or problem with this order, please contact $_SESSION[NAME] immediately at $_SESSION[PHONE].</div>";
$this->logOrder();
} else {
$this->html .= "<div id='order_sent'>Your order is empty or has already been sent.</div>";
}
}

jatar_k

12:08 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so the from header is the only thing that is wrong?

so these?

$header .= "From: $_SESSION[INTERFAXEMAIL]
\n";
$header .= "Return-Path: info@url.com\n";
$header .= "Reply-To: info@url.com\n";

try taking out the hard return, if that is actually in your code and also try concatenating the session var

$header .= "From: " . $_SESSION[INTERFAXEMAIL] . "\n";
$header .= "Return-Path: info@url.com\n";
$header .= "Reply-To: info@url.com\n";

see if that makes a difference

also you could try setting all three of those to the same email address or maybe even setting up different headers for the fax email.

what is the from coming out as?

again the description is a tiny bit vague so I may be off base on all of this.