在 Laravel 5.4 中向多个抄送收件人发送电子邮件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43762735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sending email to multiple cc recipients in Laravel 5.4
提问by prgrm
I have a function that sends an email like this:
我有一个发送电子邮件的功能,如下所示:
Mail::to($email)
->cc($arraywithemails)
->send(new document());
How do I send the email to multiple cc users? I have checked the official documentation but there is no clue there.
如何将电子邮件发送给多个抄送用户?我已经检查了官方文档,但那里没有任何线索。
回答by Mathieu Ferre
The setAdress() function in Mailable allow you to give an array as argument :
Mailable 中的 setAdress() 函数允许您提供一个数组作为参数:
So You should be able to use the function by passing an array as your argument
所以你应该能够通过传递一个数组作为你的参数来使用该函数
Mail::to($email)
->cc(['[email protected]','[email protected]'])
->send(new document());
回答by Mozammil
That should work. From the offical Laravel documentation:
那应该有效。来自官方 Laravel文档:
Mail::to($request->user())
->cc($moreUsers)
->bcc($evenMoreUsers)
->send(new OrderShipped($order));