laravel电子邮件降价模板没有在邮件正文中显示图像



我想发送带有产品图片的电子邮件。所以我用的是laravelmarkdown邮件模板。但问题是,当我发邮件时,我只收到下面给出的图像链接http://127.0.0.1:8000/storage/images/vAO6oZDeIIFYwtz95dlz5ZyqghrOTsL0GNkDycJq.png

这是我的降价模板代码:

<head>
<style>
p{
font-family:verdana;
font-size: 10px;
margin : 0;
}
.btn{
text-align:center;
} 

.loginButton { padding: 7px 15px 8px 20px; }
</style>
</head>
@component('mail::message')
<p>Dear {{ $data['supplier']->name}},</p><br>
<p>There is a new business opportunity:</p>
<p><b>Industry:</b> {{ $data['rfq']->category->industry }}</p>
<p><b>Product Category:</b> {{ $data['rfq']->category->name }}</p>
<p><b>Title:</b> {{ $data['rfq']->title }}</p>
<p><b>Quantity:</b> {{ $data['rfq']->quantity }}</p>
<p><b>Unit:</b> {{ $data['rfq']->unit }}</p>
<p><b>Unit price:</b> {{ $data['rfq']->unit_price }}</p>
<p><b>Payment method:</b> {{ $data['rfq']->payment_method }}</p>
<p><b>Delivery time:</b> {{ $data['rfq']->delivery_time }}</p><br>
<p>To reply, please login to your MerchantBay account and find the request in your RFQ menu.</p><br>
<p>You are receiving this notification because you produce Full Body in the requested country and the requested order quantity matches the information provided in your company profile. If you think this request does not fit to your business, please update your company profile.</p><br>


<p>Best regards,</p>
<p>your Merchant Bay team</p>
@foreach($data['rfq']->images as $image) 
{{ asset('storage/'.$image->image) }}<br>
{{-- <img src="{{ asset('storage/'.$image->image) }}" class="img-responsive"> --}}
@endforeach
@endcomponent

您必须将图像嵌入到电子邮件模板中
这是一个示例,您可以尝试如下

<img src="{{ embed(public_path() . '/logo.png') }}" alt="" class="top-logo" style="display: block; margin-left: auto;   margin-right: auto;">

请尝试使用helpers路径。

如果您的图像保存在公用文件夹中,请使用

public_path('folder_name/filename.png') 

或者如果它们保存在存储文件夹中,则使用

storage_path('folder_name/filename.png').

我认为你使用的是公用文件夹,因为你使用的资产((,所以你应该尝试

<img src="{{ public_path('storage/'.$image->image) }}" class="img-responsive">

Laravel Dochttps://laravel.com/docs/8.x/helpers#method-存储路径

最新更新