0

我正在向 gmail 帐户发送一封带有 PHP 的电子邮件。

$message = 
"Hi Mario

Today Luigi tried to <b>eat</b> <span style="font-size:8px">Toad</span>. 
I am so sorry that formating gmail is not standard. This mail will display the breaks made,
like in heredoc, but not the html. Help me understanding to format E-mails for 
Gmail-receivers.

It's a me
Greetings, 
Wario";

mail("mario@gmail.com", "Betreff: Luigi nibbled Toad",
$message, "From: itsame@myphpmail.com" );

我们如何格式化 Gmail 接收者看到的预格式化文本,如 font-size/weight/etc...?

4

1 回答 1

2

您需要将邮件的标题设置为 HTML 格式。在您调用mail().

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Itsame <itsame@myphpmail.com>' . "\r\n";

然后尝试使用以下内容发送它:

mail("mario@gmail.com","Betreff: Luigi nibbled Toad", $message, $headers);
于 2013-08-08T17:10:23.803 回答