【发布时间】:2011-11-24 23:21:44
【问题描述】:
我创建了一个简单的 php 电子邮件脚本,但问题是我不想在同一个 php 文件中包含大消息文本。我希望脚本从单独的 html 文件中读取消息(与显示的完全相同,带有 html 代码)。我试图用include("body.html"); 替换该消息,但不幸的是打印了html代码而不是发送它。
这是我的脚本的一个小版本
<?php
$to .= 'email@example.com';
$subject = 'Message Subject';
$message = 'This is a very important message?';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Person Name <pname@example.com>' . "\r\n";
mail($to, $subject, $message, $headers);
?>
【问题讨论】: