Is there any appetite for making allowance for multiple mail connections? #38351
-
Some of the third party API drivers which come with Laravel make allowance for multiple "connections" which can each be configured independently. Examples of this pattern would be the queue, storage and database connections. Mail, on the other hand, has only a single configurable connection by default. Of course, it's possible to extend and override this in user-land by overriding config at runtime. Recently I needed to use the new "stream" configuration for the PostMark driver in an application. The requirements were to be able to have more than one stream in use by the application and send different mailables through different streams. As far as I can see, this can't be done with the existing mail configuration options out the box. We'd have to dynamically set that stream configuration at runtime. Another related requirement was to pre-configure a failover Mail connection that could be used in the case of some catastrophic failure with a third-party mail provider. This was based on real world scenarios where a mail provider was experiencing delays that were an acceptable length, and in another case where the application's transactional emails triggered some kind of filter and were blocked by the third-party connection. The requirement was to be able to switch out to a secondary failover connection without having to re-deploy the application to ensure deliverability of mission critical messages. As I said, this is all doable at present, but requires some overloading of default behaviour and runtime config settings. If we had the ability to specify multiple mail connections as with other Laravel drivers this sort of thing could be implemented more simply in a way that was easier for developers to understand and reason about. Maybe it's too much of a fringe-case for making it a first party feature, but I wondered if there was any appetite for considering this as a feature? If so, I'd be happy to have a look at an implementation and put in a PR. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I suggest closing this as I'm pretty sure I've fundamentally understood the changes to mailers in Laravel 7. I can't see a way to close it myself. |
Beta Was this translation helpful? Give feedback.
I suggest closing this as I'm pretty sure I've fundamentally understood the changes to mailers in Laravel 7. I can't see a way to close it myself.