首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >发送邮件附件laravel 5.8

发送邮件附件laravel 5.8
EN

Stack Overflow用户
提问于 2019-05-31 01:37:25
回答 1查看 0关注 0票数 0

我尝试使用以下代码,但它没有在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);
         });

执行上面的代码后没有结果。

EN

回答 1

Stack Overflow用户

发布于 2019-05-31 10:42:13

我应该在laravel上使用Notifications,这提供了许多可以在电子邮件中使用的功能。在官方文档上查看:

https://laravel.com/docs/5.8/notifications

如果你使用它,你只需$ mail-> attach();. 它比邮件更简单。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/-100006878

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档