请参考以下代码:
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();mail($to, $subject, $message, $headers);
?>
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();mail($to, $subject, $message, $headers);
?>
$to = '[email protected]';
$subject = 'the subject';
$message = '第一行'."\r\n".
'第二行'."\r\n";
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();mail($to, $subject, $message, $headers);
?>
比如
$content = "name: mynamesucks,
sex: male,
country: China";这样发出去的邮件就会换行了,我以前做的时候就是这么做的