2012-04-03 10 views
0

私は改行文字を顧客が入力するときにメッセージを表示しようとしていますが、各行の間に/r/nがあります。 $body .= $_SESSION['username'];も別の行に表示したいと思う。PHPのメールでの改行の問題

私はこの例を使用しようとしました:PHP nl2br() basic function解決するが、成功していません。

PHP:

$body .= $_SESSION['username']; 
$body .= $message; 
$to = $email; 
$subject = "copy of your notification"; 
$headers = "From: [email protected]\r\n"; 
$headers .= 'MIME-Version: 1.0' . "\r\n"; 
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 
$headers .= 'Bcc:[email protected]' . "\r\n"; 
mail($to,$subject,$body,$headers); 

HTMLフォーム:

<form action="notification.php" method="Post" class="rl"> 
    <div> 
     <label for="message" class="fixedwidth">Message</label> 
     <textarea name="message" rows="7" cols="40" id="message"></textarea> 
    </div> 

    <div class="buttonarea"> 
     <p> 
      <input type="submit" name="notify" value="Notify"></p> 
     </div> 
    </p> 
</form> 

答えて

0

あなたはPHP_EOL定数を使用して試みることができる:

$body .= $_SESSION['username'].PHP_EOL;