我正在尝试将PHP脚本中的包含文件用作swiftmail
消息中的内容。我想做一些如下的事情,但它不起作用:
主档案:
$html = include 'testcontent.php';
$message = new Swift_Message($subject);
$message->setFrom($from);
$message->setBody($html, 'text/html');
testcontent.php看起来像这样:
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>