-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

まず、mysql_* の代わりに PDO を使用してください。また、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 に答える
0

コードに特別なヘッダーはありませんでした。Gilbert ツールは正しく、表を使用するとこのような電子メールを表示する方が簡単ですが、一部のメーリング ボックスの HTML ヘッダーを送信する必要があるため、tout を $headers に追加してみてください

于 2013-07-16T06:05:36.083 に答える