Laravel将图像嵌入到电子邮件中,在Apple Mail中将图像显示为实际大小



我正在通过Mailgun从我的laravel应用程序发送一封电子邮件。我正在使用嵌入功能,这样图像会在屏蔽图像时显示Gmail,但现在我遇到了Apple Mail的问题,如果我设置图像的宽度和高度,它会忽略这一点,并以真实文件大小显示图像。因此,如果我在电子邮件中有一个宽度和高度为100px的图像,并将宽度和高度设置为50px,Apple Mail会忽略它,但Gmail会按预期显示为50px。苹果邮件有什么问题吗?当不使用Laravel中的嵌入功能时,Apple Mail会将其显示为正确的大小。

<img src="{{ $message->embed(public_path() . '/img/mail/logo.png') }}" width="22" height="22" style="max-width: 22px;-ms-interpolation-mode: bicubic;vertical-align: middle;border: 0;line-height: 100%;height: auto;outline: none;text-decoration: none;" />

提前感谢!

-Jamie

更改代码,不要在标记中使用width和height属性。在样式中使用。我希望这能解决你的问题。

<img src="{{ $message->embed(public_path() . '/img/mail/logo.png') }}" style="width:22px; height:22px; max-width: 22px;-ms-interpolation-mode: bicubic;vertical-align: middle;border: 0;line-height: 100%;height: auto;outline: none;text-decoration: none;" />

最新更新