GMail 不显示 Laravel MailGun 驱动程序发送的 HTML 电子邮件

标签 html email laravel-5

在 Laravel 5 中使用 Mailtrap 驱动程序时,我的 HTML 电子邮件可以正常显示。但是当我切换到使用 MailGun 驱动程序电子邮件并在 Gmail 中查看时,CSS 样式无法正常工作。

这是 GMail 显示的示例原始电子邮件:

To: user@gmail.com
MIME-Version: 1.0
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.=
w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=3D"http://www.=
w3.org/1999/xhtml">
<head>
    <meta name=3D"viewport" content=3D"width=
=3Ddevice-width" />
    <meta http-equiv=3D"Content-Type" content=3D"text=
/html; charset=3DUTF-8" />
    <title>iScholar Registration</title>
   =
 <style type=3D"text/css">
        /* -----------------------------------=
--

我可以看到行后面附加了 = 符号。

这是我发送电子邮件的方式:

Mail::send(
   'email.activation',
   ['activationCode' => $activation->code, 'email' => $email],
   function ($message) use ($email) {
      $message->from('test@test.com', 'registration');
      $message->to($email);
      $message->subject('Activate your account');
   }
);

在 Laravel 5 中使用 MailGun REST 驱动程序发送 HTML 电子邮件的推荐方法是什么?

最佳答案

这与 MailGun 完全无关。为了使模板正常显示,必须内联 CSS。我使用了 https://litmus.com/help/email-clients/gmail-no-head/ 中描述的工具解决这个问题。

关于GMail 不显示 Laravel MailGun 驱动程序发送的 HTML 电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36711906/

相关文章:

delphi - 将邮件项目从一个文件夹移动到另一文件夹

php - 当我的 Postfix 收到邮件时无法触发我的 php 脚本

javascript - Laravel 在 ajax post 请求后返回空字符串

php - 如何将大文件从 S3 流式传输到 laravel View

mysql - EAV是 'bad',但是类表继承的可维护性如何呢?

javascript - 从 HTMLVideoElement 中提取帧

html - 媒体查询 div 不改变宽度,但其他一切正常

python - 使用Python通过电子邮件发送错误消息[不接受用户名和密码]

Javascript 单选按钮组验证

php - 将 javascript 日期和时间对象插入数据库