Laravel 5.6 markdown邮件中的图像在Gmail中不可见 [英] Image in Laravel 5.6 markdown mail not visible in Gmail

查看:52
本文介绍了Laravel 5.6 markdown邮件中的图像在Gmail中不可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过减价邮件发送QR图像.该图像在控制器中,然后传递给邮件格式.然后在内部尝试显示以下图像:

I am trying to send a QR image through a markdown mail. This image is in a controller and then passed to the mail format. Then inside I try to display the image with:

<img src="{{ $qr_image }}" alt="QR" title="QR" style="display:block; margin-left: auto; margin-right: auto;" width="200" height="200" data-auto-embed="attachment"/>

我正在使用 eduardokum/laravel-mail-auto-embed 包.现在来了奇怪的部分.将邮件发送到Outlook测试帐户时,QR图像显示完全没有问题.但是,当发送到gmail帐户时,我得到以下信息:.我已经尝试过data-auto-embed ="base64",但是并不能解决问题.

I am using the eduardokum/laravel-mail-auto-embed package. Now comes the odd part. When sending a mail to an outlook test account, the QR image shows without any problem at all. However when sending to a gmail account I get the following: . I have tried data-auto-embed="base64" but that didn't solve the provlem.

也许有一种方法可以通过文件路径引用 $ qr_image ,因为Google不喜欢base64?

Is maybe there a way to reference to $qr_image with a file path, since google doesn't like base64?

推荐答案

首先,确保图像在公共目录内.可能在 public/img/emails/image.jpg 之类的地方.

Firstly, make sure that the image is within the public directory. This could be somewhere like public/img/emails/image.jpg.

您现在将可以使用 asset()助手,在公共目录中创建到该文件的绝对链接.因此,以下方法应该起作用:

You will now be able to use the asset() helper which creates an absolute link to the file within the public directory. So the following should work:

<img src="{{ asset('img/emails/' . $qr_image }}" alt="QR" title="QR" style="display:block; margin-left: auto; margin-right: auto;" width="200" height="200" data-auto-embed="attachment"/>

假设 $ qr_image 只是文件的名称和扩展名.

Assuming the $qr_image is just the name and extension of the file.

这篇关于Laravel 5.6 markdown邮件中的图像在Gmail中不可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆