dougai2427 2013-03-05 22:24
浏览 32

在电子邮件消息php中输出<hr>

How can I output a thematic break (< hr>) in my email message sent using the php mail() function. In the email, it appears as < hr> itself instead of a thematic break.

  • 写回答

2条回答 默认 最新

  • dtid30526 2013-03-05 22:27
    关注

    Check out example 4:

    http://php.net/manual/en/function.mail.php

    <?php
    // multiple recipients
    $to  = 'aidan@example.com' . ', '; // note the comma
    $to .= 'wez@example.com';
    
    // subject
    $subject = 'Birthday Reminders for August';
    
    // message
    $message = '
    <html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
        <tr>
          <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
        </tr>
        <tr>
          <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
        </tr>
        <tr>
          <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
        </tr>
      </table>
    </body>
    </html>
    ';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "
    ";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
    ";
    
    // Additional headers
    $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "
    ";
    $headers .= 'From: Birthday Reminder <birthday@example.com>' . "
    ";
    $headers .= 'Cc: birthdayarchive@example.com' . "
    ";
    $headers .= 'Bcc: birthdaycheck@example.com' . "
    ";
    
    // Mail it
    mail($to, $subject, $message, $headers);
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?