-1

i want to send mail in particular format...i want to send shipping info and tracking number by mail.mail sent successfully but showing in some wiered format... below format i want to achieve ..

Dear xyz ,                                                            

Per your request, this email is to notify you that your items have been    
shipped.                                                                   

You can track the status of this order, and all of your orders, online     
by visiting your account at http://www.uline.com/MyAccount/myUline.aspx    

The following items were included in this shipment:                        
---------------------------------------------------------------------------
     Qty   UM   Item#         Description               Price   Shipped    
---------------------------------------------------------------------------
   1,000   M    S-209         4.5X5.5 INV ENCLOSED P   $0.023    1,000     
---------------------------------------------------------------------------

This shipment was sent to:                                                 

    xyz xxx                                                              
    3372 KENSINGTON DR                                                     
    AVON, OH  44011                                                        

Po#: xyz

Carrier: UPS Ground                                                        

Here are your tracking numbers:                                            

1ZA6898Axxxxxxxxx                                                         

i have tried this.....................

$subject="computermall Shipping Confirmation - Order#: ".$_REQUEST['ordid']."";

 $header="from:orders@computermall.co.in";

$content="<html><body>Dear ".$rw['firstname']."&nbsp;".$rw['lastname']."  ,    <br>                                                 

Per your request, this email is to notify you that your items have been    
shipped <br><br>                 

Here is your tracking number :  ".$_REQUEST['trackno']."   <br>   <br>                             

---------------------------------------------------------------------------<br>
Order#:     ".$row3['order_id']." <br> 
Order Date: ".$row3['order_date']."    <br>        

---------------------------------------------------------------------------<br>        

Sold To:                  <br>                                                            

".$rw['firstname']."&nbsp;".$rw['lastname']."    <br>                                                

".$rw['address']."      <br>              
".$rw['city']."      <br>    
".$rw['pincode']."    <br> <br> 

 Ship To:              <br> 

".$rw['firstname']."&nbsp;".$rw['lastname']." <br>                                                  

".$rw['address']."     <br>              
".$rw['city']."        <br>  
".$rw['pincode']."    <br> <br> 

--------------------------------------------------------------------------- <br> 
Qty&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         Product      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;               Price     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   <br> 
--------------------------------------------------------------------------- <br> ";
$s="select * from tbl_shoppingcart where cust_name='".$_REQUEST['username']."' and action='confirm' and order_id=".$_REQUEST['ordid']." order by id desc";
                    $q=mysql_query($s) or die($s);
                    $num=mysql_num_rows($q);
                    while($row=mysql_fetch_array($q)){ 
                    $_SESSION['gtotal']=$row['grand_total'];
                     echo" 
".$row['qty']."  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ".$row['p_name']."  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             Rs.".$row['price']." &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> <br>";
} echo"
---------------------------------------------------------------------------<br>
Sub-Total    Rs.".$_SESSION['gtotal']."    <br>
Shipping     00.00   <br>
Sales Tax     $0.00    <br>
Total*      Rs.".$_SESSION['gtotal']."  <br>

</body></html>";


mail($email, $subject, $content, $header);

its sending mail in this kind of format.....

<html><body>Dear chirag&nbsp;ode  ,    <br>                                                 

Per your request, this email is to notify you that your items have been    
shipped <br><br>                 

Here is your tracking number :  ab12345cd567   <br>   <br>                             

---------------------------------------------------------------------------<br>
Order#:     33133271 <br> 
Order Date: 15-07-13    <br>        

---------------------------------------------------------------------------<br>        

Sold To:                  <br>                                                            

chirag&nbsp;ode    <br>                                                

dhartipark society      <br>              
vadodara      <br>    
390002    <br> <br> 

 Ship To:              <br> 

chirag&nbsp;ode <br>                                                  

dhartipark society     <br>              
vadodara        <br>  
390002    <br> <br> 

--------------------------------------------------------------------------- <br> 
Qty&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;         Product      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;               Price     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   <br> 
--------------------------------------------------------------------------- <br>
chirag ode
  • 950
  • 7
  • 15
  • Create a pdf that is a best way to sent those info. And use tcpdf to generate pdf. – gayan Jul 16 '13 at 05:44
  • how can i use pdf in it? – chirag ode Jul 16 '13 at 05:48
  • first you can generate pdf using tcpdf (http://www.tcpdf.org/) this website has lots of examples. And you can attached that pdf to email. If you use pdf, you shouldn't have to worry about browser compatibility issues. – gayan Jul 16 '13 at 05:52
  • [this](http://htmlemailboilerplate.com/) might be a good resource for you on authoring html emails. It documents a lot of best practices and gives you a good starting point. – Orangepill Jul 16 '13 at 06:18

3 Answers3

0

For the implementation of your emails, the best way is USE table, tr AND td! Not simply br or div elements.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
GilbertOOl
  • 1,299
  • 2
  • 15
  • 27
  • i'll manage to design it with table but,after query its showing nothing.how can i manage query and while loop in it? – chirag ode Jul 16 '13 at 06:02
0

I did notre see special headers in your code. Gilbert tool ils right, displaying an email like this is easier using table but fort some mailing box HTML headers have to be send so try tout add it to $headers

0

First Please use PDO instead of mysql_* and Heredoc in PHP can help you with multiline string. :)

In case the message isn't plain text. You should include the Content-Type message header to tell your type of message's content and email client will show the message correctly.

$header  = "From: orders@computermall.co.in\r\n";
$header .= "Content-Type: text/html; charset=utf-8\r\n";
Community
  • 1
  • 1
kunemata
  • 726
  • 1
  • 6
  • 8