简体   繁体   中英

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. 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. Source : Laravel Mail::send() sending to multiple to or bcc addresses

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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