我在 Google 上搜索了解决方案,但找不到任何东西。
我正在使用 Code Igniter Framework 和 SendGrid 来执行 SMTP。我的脚本如下:
$this->email->initialize(array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.sendgrid.net',
'smtp_user' => 'MY_SENDGRID_USERNAME',
'smtp_pass' => 'MY_SENDGRID_PASSWORD',
'smtp_port' => THE_PORT_I_AM_USING,
'crlf' => "\r\n",
'newline' => "\r\n"
));
$this->email->from('info@gmail.com', 'Info');
$this->email->to("example@example.com");
$this->email->subject("My subject");
$message = "<p>Hello ...</p>
<a href="http://google.com">Click here</a> to go Google.";
$this->email->message($message);
$this->email->send();
但是,当我收到电子邮件时,它只包含纯文本形式的 HTML,如下所示:
<p>Hello ...</p>
<a href="http://google.com">Click here</a> to go Google.