Support the ongoing development of Laravel.io →
Mail Architecture Configuration
Last updated 2 years ago.
0

Just discovered this post while looking for a solution for this exact problem. So already thanks! :-)

I'm still new to Laravel myself but I do think you had a good start with how you created this.

I'm currently working with Laravel 5.2(.38) in my project and it seems a few things are no longer valid.

In createInstance() the pretend bit can no longer be used and in setMailerDependencies the setLogger bit can apparently not be used anymore either.

My suggestion:

  • Create a package for this.
  • Throw it on github and packagist
  • See what other developers can come up with through PR's

It's definitely a good start and other people will benefit from it. I know I have already :-)

Last updated 8 years ago.
0

Thanks for the reply.

Eventually I decided to use the Mandrill PHP library (https://mandrillapp.com/api/docs/index.php.html) instead of the Mailer for sending emails through Mandrill since you have a lot more options available that way (for instance, using templates). I'm still using the Multimail class, but just with a single config now.

I know that I did change some things after I posted this in order to get it working the way I wanted. In particular, I think I had to change some things in order to get it to work when called as part of a scheduled command. If I get some time, I'll try to figure out what those changes were and then package it up and put it on Github.

EDIT: I updated the code in the OP to include my latest changes. Basically I had to add a MailerExtended class which extends the Mailer class. This was necessary in order to get this to work when scheduling email jobs (vs.s sending the email immediately). And then the MultipleConfigMailer class was updated to use it.

Last updated 8 years ago.
0

Thanks for updating the OP with the queue changes, much appreciated.

At the moment I'm not using the Laravel queue related things as I built my own queue table(s) which go a bit further, more complicated. But I guess it's best to update my classes as well so it is possible to use it anyway.

Again thanks a lot :-)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.