如何包括一个html页面从服务器将显示在php电子邮件正文


How to include a html page from server which will be displayed at the php email body?

我想发送一封电子邮件,而不是'一些文本',我想要它从服务器和页面返回page.html所有的电子邮件。

$mail->Body    = 'some text';

谢谢!

使用file_get_contents实现

<?php 
// this will get content of file as a string 
$htmlContent = file_get_contents("path/to/page.html");
$mail->Body = $htmlContent;
?>

参考- 文件获取内容