newline not working in PHP mail

前端 未结 3 1190
无人共我
无人共我 2020-12-05 12:40

I\'m using the following to send an email:



        
3条回答
  •  粉色の甜心
    2020-12-05 13:34

    Not an answer to the question, but may be of help to someone.

    Send a HTML message, and instead of \n, use
    .

    And use

     or CSS for preformatted text, thus translating \n to actual new lines.

    $headerFields = array(
        "From: who@are.you",
        "MIME-Version: 1.0",
        "Content-Type: text/html;charset=utf-8"
        );
    mail($to, $subj, $msg, implode("\r\n", $headerFields));
    

提交回复
热议问题