-1

我想以特定格式发送邮件...我想通过邮件发送运输信息和跟踪号。邮件发送成功,但以某种奇怪的格式显示...以下格式我想实现..

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                                                         

我试过这个............

$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);

它以这种格式发送邮件......

<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>
4

3 回答 3

0

我没有在您的代码中看到特殊的标题。吉尔伯特工具是对的,使用表格显示这样的电子邮件更容易,但是必须发送一些邮箱 HTML 标题,所以尝试将其添加到 $headers

于 2013-07-16T06:05:36.083 回答
0

对于您的电子邮件的实施,最好的方法是使用表,tr AND td!不仅仅是 br 或 div 元素。

于 2013-07-16T05:52:12.507 回答
0

首先请使用 PDO 代替 mysql_*PHP 中的 Heredoc可以帮助您处理多行字符串。:)

如果消息不是纯文本。您应该包含Content-Type邮件标题以告知您的邮件内容类型,电子邮件客户端将正确显示邮件。

$header  = "From: orders@computermall.co.in\r\n";
$header .= "Content-Type: text/html; charset=utf-8\r\n";
于 2013-07-16T06:58:52.937 回答