简体   繁体   English

如何在Laravel中使用Mailgun发送多封电子邮件?

[英]How to send multiple emails using Mailgun in laravel?

I tried this code: 我尝试了这段代码:

$message->to(array(
                    'bb@gmail.com',
                    'zz@gmail.com'
                ));

$message->from('foo@example.com', 'Recipient Name');
$message->subject('Welcome!');

I get error: 我得到错误:

The parameters passed to the API were invalid. 传递给API的参数无效。 Check your inputs! 检查您的输入! Sandbox subdomains are for test purposes only. 沙盒子域仅用于测试目的。 Please add your own domain or add the address to authorized recipients in domain settings. 请添加您自己的域或将地址添加到域设置中的授权收件人。

Try the following code 试试下面的代码

$receivers = ['bb@gmail.com', 'zz@gmail.com'];
Mail::send('your_theme', [], function($message) use ($receivers)
{    
    $message->to($receivers)->subject('Welcome!');    
});
var_dump( Mail:: failures());
exit;

This works on my laravel 4.2, not sure about later versions. 这在我的laravel 4.2上有效,不确定以后的版本。 Source : Laravel Mail::send() sending to multiple to or bcc addresses 来源: Laravel Mail :: send()发送到多个收件人或密件抄送地址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM