Jump to content

Archived

This topic is now archived and is closed to further replies.

intersysop

Formating Email Forms

Recommended Posts

Hello, i am writing a script to email a form. I have gotten the form to work properly but now the client wants
the form to besent i a table format. this what i have so far,

<?PHP
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('track_errors', true);

function DoStripSlashes($FieldValue)
{
if ( get_magic_quotes_gpc() ) {
  return stripslashes($FieldValue);
} else {
  return $FieldValue;
}
}

#----------
# FilterCChars:

function FilterCChars($TheString)
{
return preg_replace('/[\x00-\x1F]/', '', $TheString);
}


if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ClientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$ClientIP = $_SERVER['REMOTE_ADDR'];
}

$FTGaddress = DoStripSlashes( $_REQUEST['address'] );
$FTGcity = DoStripSlashes( $_REQUEST['city'] );
$FTGstate = DoStripSlashes( $_REQUEST['state'] );
$FTGlot = DoStripSlashes( $_REQUEST['lot'] );
$FTGblock = DoStripSlashes( $_REQUEST['block'] );
$FTGphase = DoStripSlashes( $_REQUEST['phase'] );
$FTGunit = DoStripSlashes( $_REQUEST['unit'] );
$FTGplatbook = DoStripSlashes( $_REQUEST['platbook'] );
$FTGpage = DoStripSlashes( $_REQUEST['page'] );
$FTGlegal = DoStripSlashes( $_REQUEST['legal'] );
$FTGorderedby = DoStripSlashes( $_REQUEST['orderedby'] );
$FTGcompayname = DoStripSlashes( $_REQUEST['compayname'] );
$FTGaddress1 = DoStripSlashes( $_REQUEST['address1'] );
$FTGcompanyphone = DoStripSlashes( $_REQUEST['companyphone'] );
$FTGcompanyfax = DoStripSlashes( $_REQUEST['companyfax'] );
$FTGemailaddress = DoStripSlashes( $_REQUEST['emailaddress'] );
$FTGbuyers = DoStripSlashes( $_REQUEST['buyers'] );
$FTGnames = DoStripSlashes( $_REQUEST['names'] );
$FTGcontactinfo = DoStripSlashes( $_REQUEST['contactinfo'] );
$FTGtitlecompany = DoStripSlashes( $_REQUEST['titlecompany'] );
$FTGunderwriter = DoStripSlashes( $_REQUEST['underwriter'] );
$FTGdateneeded = DoStripSlashes( $_REQUEST['dateneeded'] );
$FTGclosingdate = DoStripSlashes( $_REQUEST['closingdate'] );
$FTGelevationneeded = DoStripSlashes( $_REQUEST['elevationneeded'] );
$FTGattachment = $_FILES['attachment']['name'];
$FTGB1 = DoStripSlashes( $_REQUEST['B1'] );
$FTGaccountnumber = DoStripSlashes( $_REQUEST['accountnumber'] );



# Redirect user to the error page

if ($ValidationFailed == true) {

header("Location: error.html");
exit;

}
# Email to Form Owner

$emailSubject = FilterCChars("Psi Professional Application Survey");

$emailBody = "--FTG_BOUNDRY\n"
. "Content-Type: text/html; charset=\"ISO-8859-1\"\n"
. "Content-Transfer-Encoding: base64\n"
. "\n"
. chunk_split(base64_encode("<html>\n"
. "<head>\n"
. "<title></title>\n"
. "</head>\n"
. "<body>\n"    <---- Problem Area
. "<table width="100%" border="0">\n"
. "<tr>\n" <---------- > ???
. "<td>456</td>\n"
. "</tr>\n"
. "</table>\n"
. "address : $FTGaddress<br/>\n"
. "city : $FTGcity<br/>\n"
. "state : $FTGstate<br/>\n"
. "lot : $FTGlot<br/>\n"
. "block : $FTGblock<br/>\n"
. "phase : $FTGphase<br/>\n"
. "unit : $FTGunit<br/>\n"
. "platbook : $FTGplatbook<br/>\n"
. "page : $FTGpage<br/>\n"
. "legal : $FTGlegal<br/>\n"
. "orderedby : $FTGorderedby<br/>\n"
. "compayname : $FTGcompayname<br/>\n"
. "address1 : $FTGaddress1<br/>\n"
. "companyphone : $FTGcompanyphone<br/>\n"
. "companyfax : $FTGcompanyfax<br/>\n"
. "emailaddress : $FTGemailaddress<br/>\n"
. "buyers : $FTGbuyers<br/>\n"
. "names : $FTGnames<br/>\n"
. "contactinfo : $FTGcontactinfo<br/>\n"
. "titlecompany : $FTGtitlecompany<br/>\n"
. "underwriter : $FTGunderwriter<br/>\n"
. "dateneeded : $FTGdateneeded<br/>\n"
. "closingdate : $FTGclosingdate<br/>\n"
. "elevationneeded : $FTGelevationneeded<br/>\n"
. "attachment : $FTGattachment<br/>\n"
. "B1 : $FTGB1<br/>\n"
. "accountnumber : $FTGaccountnumber<br/>\n"
. "</body>\n"
. "</html>\n"
. ""))
. "\n";

if ( is_uploaded_file($_FILES['attachment']['tmp_name']) ) {

$fileName = $_FILES['attachment']['tmp_name'];
$fileHandle = fopen($fileName, 'r');
$fileAttach = fread($fileHandle, filesize ($fileName));
fclose($fileHandle);

$fileAttach = chunk_split(base64_encode($fileAttach));

$emailBody .= "--FTG_BOUNDRY\n"
  . "Content-Type: " . $_FILES['attachment']['type'] . "; name=\"" . $_FILES['attachment']['name'] . "\"\n"
  . "Content-disposition: attachment\n"
  . "Content-transfer-encoding: base64\n"
  . "\n"
  . "$fileAttach\n"
  . "\n";
}



$emailBody .= "--FTG_BOUNDRY--\n";
$emailTo = "noctest@intersysop.com";
 
$emailFrom = "noctest@intersysop.com";
$emailFrom = preg_replace('/[\x00-\x1F]/', '', $emailFrom);
 
$emailHeader = "From: $emailFrom\n"
  . "MIME-Version: 1.0\n"
  . "Content-Type: multipart/mixed; boundary=\"FTG_BOUNDRY\"\n"
  . "\n";
 
mail($emailTo, $emailSubject, $emailBody, $emailHeader);


# Redirect user to success page

header("Location: success.html");
exit;
?>

Any sugestions.

Share this post


Link to post
Share on other sites
Remove the \n within the table.  You can't have any characters outside of the table/td/tr tags within a table.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.