Thanks for the replies - I still have no joy with it. Perhaps I should have posted the full bit of code that deals with the email:
$emailSubject = FilterCChars("You have a new order");
$emailBody = "--FTG_BOUNDRY\n"
. "Content-Type: text/plain; charset=\"ISO-8859-1\"\n"
. "Content-Transfer-Encoding: base64\n"
. "\n"
. chunk_split( base64_encode( "s_first : $FTGs_first\n"
. " Ship To:\n"
. " --------\n"
. " $s_first $b_last\n"
. " $s_addr; if ( $s_addr2 != \"\" ) { $b_addr2}\n"
. " $s_city $s_state $s_zip\n"
. " $s_country\n"
. " $s_email\n"
. " $s_phone\n"
. " \n"
. " \n"
. " Qty Price Description\n"
. " =====================================================================\n";
if($FTGNAME_1) {echo ". \"$FTGQUANTITY_1 £$FTGPRICE_1 $FTGNAME_1\n\"";}
// if($FTGNAME_2) {echo ". \"$FTGQUANTITY_2 £$FTGPRICE_2 $FTGNAME_2\n\"";}
//if($FTGNAME_3) {echo ". \"$FTGQUANTITY_3 £$FTGPRICE_3 $FTGNAME_3\n\"";}
// if($FTGNAME_4) {echo ". \"$FTGQUANTITY_4 £$FTGPRICE_4 $FTGNAME_4\n\"";}
//if($FTGNAME_5) {echo ". \"$FTGQUANTITY_5 £$FTGPRICE_5 $FTGNAME_5\n\"";}
//if($FTGNAME_6) {echo ". \"$FTGQUANTITY_6 £$FTGPRICE_6 $FTGNAME_6\n\"";}
//if($FTGNAME_7) {echo ". \"$FTGQUANTITY_7 £$FTGPRICE_7 $FTGNAME_7\n\"";}
// if($FTGNAME_8) {echo ". \"$FTGQUANTITY_8 £$FTGPRICE_8 $FTGNAME_8\n\"";}
// if($FTGNAME_9) {echo ". \"$FTGQUANTITY_9 £$FTGPRICE_9 $FTGNAME_9\n\"";}
//if($FTGNAME_10) {echo ". \"$FTGQUANTITY_10 £$FTGPRICE_10 $FTGNAME_10\n\"";}
// if($FTGNAME_11) {echo ". \"$FTGQUANTITY_11 £$FTGPRICE_11 $FTGNAME_11\n\"";}
// if($FTGNAME_12) {echo ". \"$FTGQUANTITY_12 £$FTGPRICE_12 $FTGNAME_12\n\"";}
// if($FTGNAME_13) {echo ". \"$FTGQUANTITY_13 £$FTGPRICE_13 $FTGNAME_13\n\"";}
// if($FTGNAME_14) {echo ". \"$FTGQUANTITY_14 £$FTGPRICE_14 $FTGNAME_14\n\"";}
//if($FTGNAME_15) {echo ". \"$FTGQUANTITY_15 £$FTGPRICE_15 $FTGNAME_15\n\"";}
$emailBody .= " =====================================================================\n"
. " SUBTOTAL: £$SUBTOTAL\n"
. " \n"
. " SHIPPING: £$SHIPPING\n"
. " TOTAL: £$TOTAL\n"
. "\n"
. " \n"
. " NB: This is not a payment confirmation - please wait for a separate email from Paypal confirming payment." ) )
. "\n"
. "--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"
. "s_first : $FTGs_first<br />\n"
. "s_last : $FTGs_last<br />\n"
. "s_addr : $FTGs_addr<br />\n"
. "s_addr2 : $FTGs_addr2<br />\n"
. "s_city : $FTGs_city<br />\n"
. "s_state : $FTGs_state<br />\n"
. "s_zip : $FTGs_zip<br />\n"
. "s_country : $FTGs_country<br />\n"
. "s_email : $FTGs_email<br />\n"
. "s_phone : $FTGs_phone<br />\n"
. "terms : $FTGterms<br />\n"
. "send : $FTGsend<br />\n"
. "</body>\n"
. "</html>\n"
. "" ) )
. "\n"
. "--FTG_BOUNDRY--";
$emailTo = 'Orders <orders@mydomain.com>';
$emailFrom = FilterCChars("orders@mydomain.com");
$emailHeader = "From: $emailFrom\n"
. "MIME-Version: 1.0\n"
. "Content-Type: multipart/alternative; boundary=\"FTG_BOUNDRY\"\n"
. "\n";
mail($emailTo, $emailSubject, $emailBody, $emailHeader);
As you can see, I have commented out all but the first line of the NAME, QUANTITY, etc while I test it.
From what I understand, putting the ; before the if statement closes $emailBody which I need to reopen. Even if I comment out the if statement, the way I have reopened $emailBody breaks the script and I get the 500 error again.
Below is a php script that deals with the email in a different way - can I take any tips from here? I have tried replacing $emailBody with $stremailBody and putting it on everyline, but that doesn't seem to work.
$today = date ("l, F jS Y");
$strMessageBody = "";
$strMessageBody .= "A new order has been received. A summary of this order appears below.\n";
$strMessageBody .= "\n";
$strMessageBody .= "Order Date: $today \n";
$strMessageBody .= " \n";
$strMessageBody .= "Bill To: \n";
$strMessageBody .= "-------- \n";
$strMessageBody .= " $b_first $b_last \n";
$strMessageBody .= " $b_addr \n";
$strMessageBody .= " $b_addr2 \n";
$strMessageBody .= " $b_city, $b_state $b_zip \n";
$strMessageBody .= " $b_phone \n";
$strMessageBody .= " $b_fax \n";
$strMessageBody .= " $b_email \n";
$strMessageBody .= " \n";
$strMessageBody .= " \n";
$strMessageBody .= "Ship To: \n";
$strMessageBody .= "-------- \n";
$strMessageBody .= " $s_first $s_last \n";
$strMessageBody .= " $s_addr \n";
$strMessageBody .= " $s_addr2 \n";
$strMessageBody .= " $s_city, $s_state $s_zip \n";
$strMessageBody .= " $s_phone \n";
$strMessageBody .= " \n";
$strMessageBody .= " \n";
$strMessageBody .= "Qty Price(\$) Product ID - Product Name\n";
$strMessageBody .= "===================================================================== \n";
$strMessageBody .= "$QUANTITY_1 \$$PRICE_1 $ID_1 - $NAME_1 $ADDTLINFO_1 \n";
if( $NAME_2 ) {$strMessageBody .= "$QUANTITY_2 \$$PRICE_2 $ID_2 - $NAME_2 $ADDTLINFO_2 \n";}
if( $NAME_3 ) {$strMessageBody .= "$QUANTITY_3 \$$PRICE_3 $ID_3 - $NAME_3 $ADDTLINFO_3 \n";}
if( $NAME_4 ) {$strMessageBody .= "$QUANTITY_4 \$$PRICE_4 $ID_4 - $NAME_4 $ADDTLINFO_4 \n";}
if( $NAME_5 ) {$strMessageBody .= "$QUANTITY_5 \$$PRICE_5 $ID_5 - $NAME_5 $ADDTLINFO_5 \n";}
if( $NAME_6 ) {$strMessageBody .= "$QUANTITY_6 \$$PRICE_6 $ID_6 - $NAME_6 $ADDTLINFO_6 \n";}
if( $NAME_7 ) {$strMessageBody .= "$QUANTITY_7 \$$PRICE_7 $ID_7 - $NAME_7 $ADDTLINFO_7 \n";}
if( $NAME_8 ) {$strMessageBody .= "$QUANTITY_8 \$$PRICE_8 $ID_8 - $NAME_8 $ADDTLINFO_8 \n";}
if( $NAME_9 ) {$strMessageBody .= "$QUANTITY_9 \$$PRICE_9 $ID_9 - $NAME_9 $ADDTLINFO_9 \n";}
if( $NAME_10 ){$strMessageBody .= "$QUANTITY_10 \$$PRICE_10 $ID_10 - $NAME_10 $ADDTLINFO_10 \n";}
if( $NAME_11 ){$strMessageBody .= "$QUANTITY_11 \$$PRICE_11 $ID_11 - $NAME_11 $ADDTLINFO_11 \n";}
if( $NAME_12 ){$strMessageBody .= "$QUANTITY_12 \$$PRICE_12 $ID_12 - $NAME_12 $ADDTLINFO_12 \n";}
if( $NAME_13 ){$strMessageBody .= "$QUANTITY_13 \$$PRICE_13 $ID_13 - $NAME_13 $ADDTLINFO_13 \n";}
$strMessageBody .= "===================================================================== \n";
$strMessageBody .= "SUBTOTAL: $SUBTOTAL \n";
$strMessageBody .= "TOTAL: $TOTAL \n";
$strMessageBody .= "\n";
$strMessageBody .= "FREIGHT: $SHIPPING \n";
$strMessageBody .= "\n\n";
$strMessageBody .= "Comments: \n";
$strMessageBody .= "--------- \n";
$strMessageBody .= "$comment \n";
$strMessageBody .= " \n";
if( $mode == "BOTH" || $mode == "EMAIL") {
//# Send email order to you...
$mailheaders = "From: $b_email\r\n";
$mailheaders .="X-Mailer: PHP Mail generated by:NOP Design Shopping Cart\r\n";
$subject = "New Online Order";
mail($youremail, $subject, $strMessageBody, $mailheaders);
The above script is from NOPcart - I use NOPer CART which is similar, but has no support forum, hence why I am here!! I am sure if the above works, there is a way that I can convert it for use with my script, however, as I said, I've had no luck so far. [sigh]