...

View Full Version : SendMail Extreme Formatting



sftl99
07-01-2005, 10:32 PM
Here is the sendmail code:

<?php

$redirectURL = "http://www.jasonpcarroll.com/allcomponents/ccount/click.php?id=1";
$MailToCC = "jcarroll@allcomponents.com";

if (preg_match ("/".$_SERVER["SERVER_NAME"]."/i", $_SERVER["HTTP_REFERER"])) {
$w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><div align=\"center\"><img src=\"http://www.allcomponents.com/site/images/nav_logo.gif\"><br>
<b><font size=\"3\" face=\"Arial, Helvetica, sans-serif\">INSIGHT BID DESK</font></b><br>
<font size=\"2\" face=\"Arial, Helvetica, sans-serif\">QUOTATION</font><br><br></div><table border=\"0\" cellspacing=\"0\" cellpadding=\"1\">";
if (count($_GET) >0) {
reset($_GET);
while(list($key, $val) = each($_GET)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$w4fMessage .= "$vala, ";
}
$w4fMessage .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= ""; }
else { $w4fMessage .= "<tr><td><font size=\"2\" face=\"verdana,arial\"><b>$key: &nbsp;</b></font></td><td><font size=\"2\" face=\"arial\">$val</font></td></tr>"; }
}
}
} // end while
}//end if
else {
reset($_POST);
while(list($key, $val) = each($_POST)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$w4fMessage .= "$vala, ";
}
$w4fMessage .= "<br>";
}
else {
$val = stripslashes($val);
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= ""; }
else { $w4fMessage .= "<tr><td><font size=\"2\" face=\"verdana,arial\"><b>$key: &nbsp;</font></b></td><td><font size=\"2\" face=\"arial\">$val</font></td></tr>"; }
}
}
} // end while
}//end else
$w4fMessage = "<font face=\"Arial, Helvetica, sans-serif\" size=2>".$w4fMessage."</font></tr></table></body></html>";
if (!$Email) {$Email = "server@site.com";}
if (!mail($InsightRep, $QuoteNumber, $w4fMessage, "From: $SalesRep <$MailToCC>\r\nReply-To: $Name <$MailToCC>\r\nMessage-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\nMIME-Version: 1.0\r\nX-Priority: 3\r\nX-Mailer: PHP/" . phpversion()."\r\nX-MimeOLE: Produced By Web4Future Easiest Form2Mail v1.5\r\nCc: $MailToCC\r\nContent-Type: text/html; charset=ISO-8859-1\r\nContent-Transfer-Encoding: 8bit\r\n")) { echo "Error sending e-mail!";}
else { header("Location: ".$redirectURL); }
} else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}
?>
Here is my example (http://www.jasonpcarroll.com/allcomponents/quotation.html)
I am having a weird glitch where sometimes a "$key" won't have the proper font formatting and sometimes I get a randomly placed "!". Can anyone figure out what the heck is going on? Fill in your own email address in the "Insight Rep Email" field and you will be the recipient of the form (if you want to try it out and see the glitches).

I also would like to know if there is any way to make a seperate format for the fields: "PartNumber, SKU, Qty, Price, Extension". I would like to have those fields (and PartNumber2, SKU2, etc.) in their own table on the email. Is this doable at all?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum