HTML 标签显示在邮件中
HTML tags are displayed in mail
我正在尝试在 php 中通过邮件发送文本。该消息放置在 HTML 标记内。发送时,邮件部分有效,但我收到的文本中有 HTML 个标签。
为了更好地理解我的问题,下面是代码:
$car = "1223455667";
$to = "something@sample.com";
$subject = 'Test Mail';
$message = '<p>' . $car . '</p>';
$from = 'mymail@sample.com';
if(mail($to, $subject, $message )){
echo 'success';
}else{
echo 'Unable to send the email. Please try again.';
}
我在邮件中收到的输出:
我希望这样的输出:1223455667
在您的邮件中传递Headers
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
if(mail($to, $subject, $message, $headers )){
echo 'success';
}else{
echo 'Unable to send the email. Please try again.';
}
我正在尝试在 php 中通过邮件发送文本。该消息放置在 HTML 标记内。发送时,邮件部分有效,但我收到的文本中有 HTML 个标签。
为了更好地理解我的问题,下面是代码:
$car = "1223455667";
$to = "something@sample.com";
$subject = 'Test Mail';
$message = '<p>' . $car . '</p>';
$from = 'mymail@sample.com';
if(mail($to, $subject, $message )){
echo 'success';
}else{
echo 'Unable to send the email. Please try again.';
}
我在邮件中收到的输出:
我希望这样的输出:1223455667
在您的邮件中传递Headers
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
if(mail($to, $subject, $message, $headers )){
echo 'success';
}else{
echo 'Unable to send the email. Please try again.';
}