楼上的大哥!你搞笑呀……
nl2br只对\n才有用……

解决方案 »

  1.   

    不好意思,写错了,用htmlspecialchars();
      

  2.   

    文本格式的邮件:
    mail("[email protected]", "My Subject", "Line 1\nLine 2\nLine 3");
    HTML格式的邮件:
    /* recipients */
    $recipient .= "Mary <[email protected]>" . ", " ; //note the comma
    $recipient .= "Kelly <[email protected]>" . ", ";
    $recipient .= "[email protected]";/* subject */
    $subject = "Birthday Reminders for August";/* message */
    $message .= "The following email includes a formatted ASCII table\n";
    $message .= "Day \t\tMonth \t\tYear\n";
    $message .= "3rd \t\tAug \t\t1970\n";
    $message .= "17rd\t\tAug \t\t1973\n";/* you can add a stock signature */
    $message .= "--\r\n"; //Signature delimiter
    $message .= "Birthday reminder copylefted by public domain";/* additional header pieces for errors, From cc's, bcc's, etc */$headers .= "From: Birthday Reminder <[email protected]>\n";
    $headers .= "X-Sender: <[email protected]>\n";
    $headers .= "X-Mailer: PHP\n"; // mailer
    $headers .= "X-Priority: 1\n"; // Urgent message!
    $headers .= "Return-Path: <[email protected]>\n";  // Return path for errors//此处就是与文本邮件不同的地方
    /* If you want to send html mail, uncomment the following line */
    $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type$headers .= "cc: [email protected]\n"; // CC to
    $headers .= "bcc: [email protected][email protected]"; // BCCs to/* and now mail it */
    mail($recipient, $subject, $message, $headers);//摘自PHP MANUAL E文班