How do I send a single email to all administrators in Aravel 5.4?

Asked

Viewed 300 times

-4

I need to implement the sending of emails to a certain group of users, such as administrators, editors, reviewers.

You’d have to use a queue for that or something like that?

Anyway, I want to select a certain group of users and send an email to all emails from this group. This is possible?

I’m using version 5.4 of the Standard.

  • It is not easier to use the option bcc (send email with hidden copy)?

1 answer

0

Laravel 5.4

According to the documentation

https://laravel.com/docs/5.4/mail#sending-mail

The method to() , accepts an email address, an instance of user, or a collection of user can also pass a collection of objects that Mailer will automatically extract the name and email property to define the recipients.

The use of queues is recommended to decrease response time.

I do not advise to put multiple addresses in one email some providers reject messages with too many addresses.

Mail::to($request->user())
    ->cc($coleccao_de_users)
    ->bcc($coleccao_de_objectos)
    ->send(new Anuncio($anuncio));
  • It will be necessary a foreach to extract each email and name and so send the email to home user?

  • I think it depends on the number of users, 5, 10, 15, 1000 ...

  • In case one of the groups has 20 users. Do I really need to use a foreach? Or does Bcc resolve?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.