I have a php mailer script that has data strings sent to it via form post. The script seems to work fine apart from the emails that are generated. All the data strings are not sent in the email. This includes the to and from adrresses so the email is rejected by the server.
Here are the parts of the script that read the data strings then send the data by email.
Why is the data not being picked up in the email????
// 1. Step: Read existing data
// ====================================
// Configuration
$strSiteDirectory=$HTTP_POST_VARS["SiteDirectory"];
// Convert isDialogue into a cariable of type bool ( true/false )
$boolIsDialogue=$CBool[$HTTP_POST_VARS["IsDialogue"]];
// Recipient
$strSenderName=$HTTP_POST_VARS["SenderName"];
$strTo=$HTTP_POST_VARS["To"];
$strFrom=$HTTP_POST_VARS["From"];
$strSubject=$HTTP_POST_VARS["Subject"];
// 2. Step: Define Workflow
// ===========================
// Check whether the message is an
// order or a contact request.
// Contact Request
if ($boolIsDialogue)
{
// 3. Step (a): Read existing data
// Read the customers contact request
$strMessage=$HTTP_POST_VARS["Message"];
// 4. Step (a) ; Send email
// Send the contact request by email using
// the Send_ContactRequest method ( see further down )
if ($continue)
{
}
// Order
}
else
{
// 3. Step (b): Read existing data
// Read the customers order request
$strMessage=$HTTP_POST_VARS["Message"];
$strHeaderUser=$HTTP_POST_VARS["HeaderUser"];
$strHeaderProvider=$HTTP_POST_VARS["HeaderProvider"];
$strFooterUser=$HTTP_POST_VARS["FooterUser"];
$strFooterProvider=$HTTP_POST_VARS["FooterProvider"];
$strProlog=$HTTP_POST_VARS["Prolog"];
$strBillToData=$HTTP_POST_VARS["BillToData"];
$strShipToData=$HTTP_POST_VARS["ShipToData"];
$strDeliveryMethodData=$HTTP_POST_VARS["DeliveryMethodData"];
$strPaymentMethodData=$HTTP_POST_VARS["PaymentMethodData"];
// 4. Step (b) [1]: Send email to store provider
// Send the order request to the store provider
// using the Send_OrderToProvider method ( see further down )
if ($continue)
{
Send_OrderToProvider(); }
// 4. Step (b) [2]: Send email to customer
// Send the order request to the customer
// using the Send_OrderToCustomer method ( see further down )
if ($continue)
{
Send_OrderToCustomer(); }
// Send_ContactRequest
// this routine sends a contact request as an email
function Send_ContactRequest(){
$To=$strTo;
$Subject=$strSubject;
$Body=$strMessage;
mail($To,$Subject,$Body);
//send the mail
}
// Send_OrderToProvider
// This method sends an order as an email to the provider
function Send_OrderToProvider(){
$To = $strTo;
$Subject = $strSubject;
//Generate Message
//because the email consists of several parts,
//these parts have to be put together here.
$strEmailContent = $strProlog;
$strEmailContent .=$strHeaderProvider;
$strEmailContent .=$strBillToData;
$strEmailContent .=$strShipToData;
$strEmailContent .=$strDeliveryMethodData;
$strEmailContent .=$strPaymentMethodData;
$strEmailContent .=$strMessage;
$strEmailContent .=$strFooterProvider;
$Body=$strEmailContent;
mail($To,$Subject,$Body);
//send the mail
}
// Send_OrderToCustomer
function Send_OrderToCustomer(){
$To= $strFrom;
// Add Subject and Message
$Subject=$strSubject;
// Generate Message
// because the email consists of several parts,
// these parts have to be put together here.
$strEmailContent = $strProlog;
$strEmailContent .=$strHeaderUser;
$strEmailContent .=$strBillToData;
$strEmailContent .=$strShipToData;
$strEmailContent .=$strDeliveryMethodData;
$strEmailContent .=$strPaymentMethodData;
$strEmailContent .=$strMessage;
$strEmailContent .=$strFooterUser;
$Body=$strEmailContent;
mail($To,$Subject,$Body);
//send the mail
}