duankong8998 2013-09-28 05:53
浏览 44
已采纳

在电子邮件php的文本中添加新换行符

I am using the following code

$message = $mess0 . "</br>" . $mess1 . "</br>" . $mess2 . "</br>" .  $mes1 . "</br></br>" . $mes2 . "</br>" . $mes23 . "</br></br>" . $mes3  . "</br></br>" .  $mes4 . "</br>" . $mes5 . "</br>" . $mes6 . "</br>" . $mes7 . "</br>" .  $mes8 . "</br>" .  $mes9 .  "</br></br>" . $mes10 ;

$message = "<html><body><p>".$message."</p></body></html>"; 

$this->Mail($storeEmail, $subject, $message);

    function Mail($to, $subject, $message) 
    {
        $headers  = 'MIME-Version: 1.0' . "
";
        $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
        $headers .= 'From: The Vow Engagement Ring Finder <thevow.engagement@gmail.com>' . "
";

        // Mail it
        if(!mail($to, $subject, $message, $headers)) {
            throw new Exception('There was a problem trying to send an email.');
        }
    }

The problem is all is i get is one paragraph. I have added <br>s but its like they don't work. The mail I get is simple paragraph without any new line feeds.

  • 写回答

2条回答 默认 最新

  • dongwu9063 2013-09-28 06:03
    关注

    Mistake in <br /> tags

    $message = $mess0 . "</br>" . $mess1...
                         ^^^^^^
    

    Replace all </br> with <br />

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号