【发布时间】:2020-04-19 19:00:04
【问题描述】:
我有一组图像路径可以附加到电子邮件中。如何在电子邮件模板中查看它们?
发送邮件控制器:
$files = collect(json_decode($img_files))->map(function ($file) {
return public_path('uploads' . DIRECTORY_SEPARATOR . $file->name);
})->toArray();
Mail::to($customer_email)->send(new SendMail($customer_firstname, $pathToFile), function($message){
foreach ($files as $filePath) {
$message->attach($filePath);
}
}
);
在我的电子邮件模板中:
<img src="{{ $message->embed($filePath) }}" style="width:600px;height:335px">
但这给出了Undefined variable: filePath 错误。我怎么能这样
【问题讨论】:
标签: php laravel email laravel-5 notifications