我尝试使用以下代码,但它没有在laravel 5.8中发送任何电子邮件,但它无法正常工作
$filepath = Storage::url($item->domain_name.'txt');
$data = array(
'owner' => 'cesiaschirebvu@afri-com.net',
'email' => "dnsadmin@reg.ai.co.zw",
'message' => "Registration of the"." ".$item->domain_name." "."domain was successful"
);
$file_to_attach = $filepath;
$filename = $item->domain_name.'txt';
Mail::send('email', $data, function ($message) use ($data, $file_to_attach,$filename ) {
$message->from($data['email']);
$message->to($data['owner']);
$message->attachData($file_to_attach, $filename);
});
执行上面的代码后没有结果。
发布于 2019-05-31 10:42:13
我应该在laravel上使用Notifications,这提供了许多可以在电子邮件中使用的功能。在官方文档上查看:
https://laravel.com/docs/5.8/notifications
如果你使用它,你只需$ mail-> attach();. 它比邮件更简单。
https://stackoverflow.com/questions/-100006878
复制相似问题