【发布时间】:2018-02-12 12:24:57
【问题描述】:
我这样发送电子邮件的代码:
public function toMail($notifiable)
{
return (new MailMessage)
->subject('Test')
->markdown('vendor.mail.markdown.message', ['data' => $this->data]);
}
我的 message.blade 视图如下:
@component('mail::layout')
{{-- Header --}}
@slot('header')
@component('mail::header', ['url' => config('app.url')])
{{ config('app.name') }}
@endcomponent
@endslot
{{-- Body --}}
This is your logo
![Some option text][logo]
[logo]: {{asset('img/my-logo.png')}} "Logo"
{{-- Subcopy --}}
@isset($subcopy)
@slot('subcopy')
@component('mail::subcopy')
{{ $subcopy }}
@endcomponent
@endslot
@endisset
{{-- Footer --}}
@slot('footer')
@component('mail::footer')
© {{ date('Y') }} {{ config('app.name') }}. All rights reserved.
@endcomponent
@endslot
@endcomponent
发送邮件成功,但邮件内容如下:
This is your logo
![Some option text][logo]
[logo]: http://myshop.dev/img/my-logo.png "Logo"
图片不显示
我该如何解决这个问题?
【问题讨论】:
-
Laravel 文档显示它没有用于图像的电子邮件组件。您很可能必须自己制作。
-
@Stuart Murphy,你是什么意思?尽量详细回答
-
您是从本地发送电子邮件吗?
-
@Ashish Patel,是的。我从本地发送电子邮件
-
好的,然后让您的应用上线。然后按照@sletheren 的步骤进行操作。
标签: laravel email notifications laravel-5.4