问题描述
需要帮助:如何发送带有嵌入式图像的电子邮件?
Need help: how to send emails with inline image?
响应返回200 OK,但未发送电子邮件.但是当我删除$ message-> embed()时,一切都很好.
The response returns 200 OK but email is not being sent. But when I removed $message->embed() everything is alright.
我在查看文件中使用了{{$ message-> embed('img/logo.png')}},但电子邮件未发送,图片位置是否错误? (我在public/img目录和app/views/emails/img目录中尝试了logo.png,我的电子邮件查看文件在app/views/emails/mail.blade.php中).还是其他内容?
I used {{ $message->embed('img/logo.png') }} in the view file, but the email is not sending, is it wrong location of image? (i have triedputting logo.png in public/img dir and app/views/emails/img dir, my email view file is in app/views/emails/mail.blade.php).Or is it something else?
推荐答案
用于嵌入图像,请尝试以下操作:
for Embeding an image try this:
<img width="250px" src="{{ $message->embed(public_path('img/logo.png')) }}" alt="logo">
请记住,文件夹img必须是公共的.
remember that folder img must be in public.
这篇关于Laravel 4:无法使用嵌入式嵌入发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!