multiple mail configurations

后端 未结 7 650
遇见更好的自我
遇见更好的自我 2020-11-28 07:13

I configured laravel\'s mail service with mandrill driver. No problems here!

Now, at certain point of my application, I need to send a mail via gmail.

I did

7条回答
  •  無奈伤痛
    2020-11-28 07:43

    Using only setSwiftMailer as explained by Bogdan didn't work for me, because then the from and adress options where still taken from config/mail.php. Also it wasn't working with queues.

    I created a package called multiMail to solve this.

    One can setup the mail adress and host/provider/username/passwort etc in /config/multimail.php and then one can send the mails using

    \MultiMail::from('office@example.com')->send(new MailableDummy()));
    \MultiMail::from('contact@otherdomain.de')->send(new MailableDummy()));
    

    or queue it

    \MultiMail::from('office@example.com')->queue(new MailableDummy()));
    

提交回复
热议问题