learningcurve Posted July 16, 2013 Share Posted July 16, 2013 I have this code that sends two emails (among other things). When the order is see on the order review web page it looks fine and the page breaks are there. When the email is sent, the received email does not have the page breaks that should be showing on lines 76-106 of the code below. The mail does get sent and there are no error messages so I am at a loss. <?php include_once("db.php"); include_once("globals.php"); error_reporting(E_PARSE); if (isset($_POST['submit'])) { extract($_REQUEST); if($id_subcount==2){ $discount_rate=DISCOUNT_2Journals; } elseif($id_subcount==3){ $discount_rate=DISCOUNT_3Journals; }else{ $discount_rate=""; } $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $contact_name=$lastname.", ".$firstname; $emails = array(); // The receipt header is only sent to the person that placed the order $receiptHeader = <<<EndOfText <p>Your order from the Journal has been received and we will begin processing it once we have received your payment. Please allow 7-10 days for you payment to be processed and for your order to be carried out. If your order includes online access, you will receive an email containing instructions upon the completion of your order.</p> <p>Thank you and enjoy!</p> <p>Below is the information we received from your submission. If you notice any errors, please contact us immediately so we can correct them.</p> EndOfText; if ($JECT === 'JECTindividual_print') { $JECTorder = 'JECT Individual Print Subscription'; } elseif ($JECT === 'JECTindividual_electronic'){ $JECTorder = 'JECT Individual Electronic Subscription'; } elseif ($JECT === 'JECTinstitutional_electronic'){ $JECTorder = 'JECT Insitutional Subscription'; } elseif ($JECT === 'JECTindividual_combo'){ $JECTorder = 'JECT Individual Combo Subscription'; } elseif ($JECT === 'JECTinstitutional_print'){ $JECTorder = 'JECT Institutional Print Subscription'; } else { $JECTorder = 'JECT subscription'; } if ($JCTL === 'JCTLindividual_print') { $JCTLorder = 'JCTL Individual Print Subscription'; } elseif ($JCTL === 'JCTLindividual_electronic'){ $JCTLorder = 'JCTL Individual Electronic Subscription'; } elseif ($JCTL === 'JCTLinstitutional_electronic'){ $JCTLorder = 'JCTL Insitutional Subscription'; } elseif ($JCTL === 'JCTLindividual_combo'){ $JCTLorder = 'JCTL Individual Combo Subscription'; } elseif ($JCTL === 'JCTLinstitutional_print'){ $JCTLorder = 'JCTL Institutional Print Subscription'; } else { $JCTLorder = 'JCTL subscription'; } if ($LCJ === 'LCJindividual_print') { $LCJorder = 'LCJ Individual Print Subscription'; } elseif ($LCJ === 'LCJindividual_electronic'){ $LCJorder = 'LCJ Individual Electronic Subscription'; } elseif ($LCJ === 'LCJinstitutional_electronic'){ $LCJorder = 'LCJ Insitutional Subscription'; } elseif ($LCJ === 'LCJindividual_combo'){ $LCJorder = 'LCJ Individual Combo Subscription'; } elseif ($LCJ === 'LCJinstitutional_print'){ $LCJorder = 'LCJ Institutional Print Subscription'; } else { $LCJorder = 'LCJ subscription'; } $receipt = $contact_name."\n"; if ($_POST['department']!='') $receipt .= $_POST['department']."\n"; if ($_POST['institution']!='') $receipt .= $_POST['institution']."\n"; $receipt .= $_POST['address']."\n"; $receipt .= $_POST['city'].', '.$_POST['state'].' '.$_POST['zip']."\n"; $receipt .= $_POST['country']."\n"; $receipt .= $_POST['phone']."\n"; $receipt .= $_POST['email']."\n\n"; $order_details=""; $order = '<table border="1"><tr><th>Item</th><th>Base Price<br />(Single Year)</th><th>Your Price<br />(Single Year)</th>Length</th><th>Renewal?</th></tr>'; if($JECT && $JECT!="no"){ if($JECTrenewal){ $rene1="Yes";} else { $rene1="No";} $order_details .=$JECTorder."\n"; $order .= "<tr><td>".$JECTorder."</td><td>".$itemprice1."</td><td>".$jectprice_hidden."</td><td>".$JECTsub."</td><td>".$rene1."</td></tr>"; } if($JCTL && $JCTL!="no"){ if($JCTLrenewal){ $rene2="Yes";} else { $rene2="No";} $order_details .=$JCTLorder."\n"; $order .= "<tr><td>".$JCTLorder."</td><td>".$itemprice2."</td><td>".$jctlprice_hidden."</td><td>".$JCTLsub."</td><td>".$rene2."</td></tr>"; } if($LCJ && $LCJ!="no"){ $order_details .=$LCJorder."\n"; if($LCJrenewal){ $rene3="Yes";} else { $rene3="No";} $order .= "<tr><td>".$LCJorder."</td><td>".$itemprice3."</td><td>".$lcjprice_hidden."</td><td>".$LCJsub."</td><td>".$rene3."</td></tr>"; } $order .="</table>"; $receipt .= $order; $receipt .= "\n\nSubtotal: ".$subtotal; $receipt .= "\n\nDiscount: ".$discount."%"; $receipt .= "\n\nGrand total: ".$total; $receipt .= "\n\nPaying by: ".$payment_method; $message=$receiptHeader.$receipt; if($JCTLrenewal){ $JCTLrenewal="Yes";} else $JCTLrenewal="No"; if($LCJrenewal){ $LCJrenewal="Yes";} else $LCJrenewal="No"; if($JECTrenewal){ $JECTrenewal="Yes";} else $JECTrenewal="No"; $sql_insert="INSERT INTO orders SET type='$subscription_type',order_details='$order_details',subtotal='$subtotal',discount='$discount' ,grand_total='$total',payment_method='$payment_method',contact_name='$contact_name',email='$email',net_addresses='$net_addresses', department='$department',phone='$phone',address='$address',city='$city',state='$state',zip='$zip',country='$country',tech_contact='$tech_contact', tc_phone='$tc_phone',tc_email='$tc_email',tier='$tier',ip='".$_SERVER['REMOTE_ADDR']."',processed_date='".date("Y-m-d H:i:s")."', jectprice='$jectprice_hidden',jctlprice='$jctlprice_hidden',lcjprice='$lcjprice_hidden',jectrenewal='$JECTrenewal',jctlrenewal='$JCTLrenewal',lcjrenewal='$LCJrenewal', jctllength='$JCTLsub',jectlength='$JECTsub',lcjlength='$LCJsub' "; //echo $sql_insert;exit; $result=mysql_query($sql_insert); $ids=mysql_insert_id(); $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n"; $headers .= "From: Subscription Manager <journals@consulting.com>" . "\r\n"; $subject="Your order has been received"; $subject1="CELTUA Journal order for $contact_name"; @mail($email, $subject, $message, $headers); @mail("journals@consulting.com", $subject1, $message, $headers); if ($_POST['payment_method']!='Credit card (online)') { header("Location: order_thankyou.php"); } else { include 'header.php'; ?> <h1>Journal Order, continued</h1> <h2>Step 2: Make online payment</h2> <p>You will now be taken to a secure payment site to enter your credit card information and complete your online payment.</p> <p><strong>Please have your credit card ready.</strong></p> <p>Please note that if you remain on any one page of the payment site for more than about 10 minutes, even if you are working on it, it will close and send you to our "thank you" page <strong>without</strong> accepting your payment. If this happens, or if you have any other problems or questions, please contact:</p> <p>John Doe</br> Circulation Manager</br> c/o Consulting</br> <form method="post" action="https://commerce.cashnet.com/404Handler/pageredirpost.aspx?virtual=CELTJP"> <p> <?php $x = 1; // incrementing field name/number if($JECT && $JECT!="no"){ $itemcode1=$JECTitemCode; $itemprice1=$jectprice_hidden; echo "<input type='hidden' name='itemcode$x' value='$itemcode1'> <input type='hidden' name='amount$x' value='".round($itemprice1,2)."'>\n"; $x++; } if($JCTL && $JCTL!="no"){ $itemcode1=$JCTLitemCode; $itemprice1=$jctlprice_hidden; echo "<input type='hidden' name='itemcode$x' value='$itemcode1'> <input type='hidden' name='amount$x' value='".round($itemprice1,2)."'>\n"; $x++; } if($LCJ && $LCJ!="no"){ $itemcode1=$LCJitemCode; $itemprice1=$lcjprice_hidden; echo "<input type='hidden' name='itemcode$x' value='$itemcode1'> <input type='hidden' name='amount$x' value='".round($itemprice1,2)."'>\n"; } ?> <input type="hidden" name="ref1type1" value="ID"> <input type="hidden" name="ref1val1" value="<?php echo $ids; ?>"> <input type="hidden" name="ref2type1" value="STORE"> <input type="hidden" name="ref2val1" value="journals"> <input type="hidden" name="ref3type1" value="NAMEFIRST"> <input type="hidden" name="ref3val1" value="<?php echo $firstname; ?>"> <input type="hidden" name="ref4type1" value="NAMELAST"> <input type="hidden" name="ref4val1" value="<?php echo $lastname; ?>"> <input type="submit" value="Make online payment"> </p> </form> <?php include 'footer.php'; } } ?> Quote Link to comment Share on other sites More sharing options...
Solution AbraCadaver Posted July 16, 2013 Solution Share Posted July 16, 2013 Those are newline characters. They may display a new line in plain text but your email is Content-type: text/html; so you would need to use <br /> Quote Link to comment Share on other sites More sharing options...
learningcurve Posted July 16, 2013 Author Share Posted July 16, 2013 D'oh! That's it. Thanks so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.