lundi 28 novembre 2016

Laravel send mail to multiple recipients with their name

We can send mails to multiple recipients by passing the array of recipients in the $message->to() function of mail. Send Mail to Multiple Recipients

But how can I add the names of these recipients which are in array to the mail. For Example: When I send a mail to single recipient then its like where we can pass the second parameter as name of the recipient.

$message->to("alex_test@gmail.com", "Alex");

But when I send the mail to multiple recipients the its like:

$emails = ['email@esomething.com', 'email1@esomething.com','email2@esomething.com'];

Mail::send('emails.welcome', [], function($message) use ($emails)
{    
    $message->to($emails)->subject('This is test e-mail');    
});

Is there a way that I can add the names of the recipients to this.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire