Laravel 4: Cannot send email with inline embedding

时光怂恿深爱的人放手 提交于 2019-12-22 09:46:44

问题


Need help: how to send emails with inline image?

The response returns 200 OK but email is not being sent. But when I removed $message->embed() everything is alright.

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?


回答1:


for Embeding an image try this:

<img width="250px" src="{{ $message->embed(public_path('img/logo.png')) }}" alt="logo">

remember that folder img must be in public.




回答2:


Try using URL::asset('img/logo.png') instead of the direct path and always put your static files in public folder.



来源:https://stackoverflow.com/questions/24464413/laravel-4-cannot-send-email-with-inline-embedding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!