New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New email service based on Symfony Mailer #12096
Comments
I don't know if anything at all survived from DB's dream of using Microservices or even headless Mautic, but I think this is an excellent time to try to decouple email sending from the rest of Mautic. |
Thanks for the feedback, Yosu! Queuing the emails will be the second part of the email refactoring. Once the emails are in a queue then you can use any microservice to process it. @mabumusa1 implemented the queue into in 1 PR before but it was too big to review and test and so he split it into replacing the Swiftmailer library first and the Symfony Mailer implementation comes right after that. |
John @escopecz , thanks for the extended explanation. If it is faster, more reliable and easier to extend, you are doing a great job indeed. I'm just sorry I missed the entire discussion about email refactoring that clearly happens somewhere else... |
In this case the core functionality of the system from my perspective is about sending messages. Not explicitly emails. Though emails is the primary channel most of us use it seems like it would be better to create an interface that abstracts away from implementation of email specifically. I know this would be a massive shift but after it the interface should be very stable. |
@YosuCadilla I would expect that you would be more upset about the dead dependency that needs replacing than the fact that the community is actively working on the replacement. It was discussed in:
It all happens in open forums where anyone can join and comment or suggest a better solution. In fact, notice that there is call for reviewers and testers every Friday and sometimes even more times per week. The SwiftMailer replacement is still an open PR. There is nothing set in stone. Please join the reviewers and testers with your expertise. We really need more active testers and reviewers to move faster. @YouBuiltThat Good point! Do you know of another channel that can use batch messages other than some email service providers? I don't want to refactor all the channels at this point but we can definitely prepare the interfaces to be used by other channels too. |
Thank you @escopecz, I see you publish in several important spaces. What I'm trying to convey, is that certain topics could/should be presented to a broader audience, these spaces you listed, are mostly frequented by programmers, hence, a marketer, a data scientist, even a Devops, will probably not be reading those messages that you posted. That is why, I believe that in cases where a decision will impact what these kinds of professionals do for a living, It might be a good idea to let them know, or even ask them for input, for the good of the community and for a better quality of the software product we are building together, Mautic. The more people participating, the better the end result (If we can get to a solution, of course). |
@YosuCadilla I completely agree with you. That's why I created this issue. Please suggest:
|
@escopecz Sorry for the delay, I know this is urgent.
|
Today I had a quick chat with @RCheesley on this topic, she already had advanced a lot in this direction, she shared with me some docs and broadened my point of view. I'll be reading the existing content and meeting with Ruth again tomorrow. |
Where do we meet? |
I would love to join as well, please ping me |
Sorry @escopecz I totally missed your msg here. On the topic of facilitating inter-silos communications, I basically explained what I had in mind to Ruth and then we discussed possibilities. If you have the time, I would be delighted to meet with you @escopecz and with any other interested developers, explain the current concept we arrived to, and then we can discuss the developer's side of it, so you can show me how it would work best on the devs side? |
Let's schedule a call with fixed time and place so everyone interested can join. Perhaps announce it in the #t-product and #dev channels in Slack where most active devs hang out? I was looking for some link to join the call yesterday but did not find any here nor in Slack. @mabumusa1 is better detective than I am :) |
@escopecz Yes, let's do that, what about next Wednesday? (so we have time to communicate first). |
Apologies. I was off on Monday due to state holiday. Wednesday is tomorrow. I'll move this discussion to Slack, the #t-product channel as it's not related to this issue. Edit: Here is the Slack discussion: https://mautic.slack.com/archives/CQMKV0RU1/p1683629679843659 |
Is there a simple way to get mautic to send emails as HTTP post? I used the mailgun plugin for a while but now i'm using a different mail server which offers sending my API ( http post ) I looked around, all other plugins / addons always add some extra layers that I can't easily modify, Is there a simple script I can use with Mautic where I can define the post URL, and fields to be sent? tnx |
@k040711 sadly, there is no such simple option. Each email service provider has different way how to authenticate and different API. So each must have its own plugin that implements that. |
Is there a plugin for Postal Mail Server's API?, I've looked around but did not find one |
I don't see such library for Symfony Mailer, no. It would have to be created from scratch. |
Hello @escopecz Not sure to what extend the changes in the email service would affect the following or should be taking into consideration the following: Also, as reference, this was found on Github: And this is on the forums: Only tangentially related, but could be added to the development: And this could be the solution? Or maybe it is the perfect time for the entire mailing system to be reconsidered? |
This issue has been mentioned on Mautic Community Forums. There might be relevant details there: https://forum.mautic.org/t/dnc-transactional-emails/21619/10 |
This issue has been mentioned on Mautic Community Forums. There might be relevant details there: https://forum.mautic.org/t/multiple-smtp-settings-for-different-mailing-segments/18446/18 |
@YosuCadilla thanks for the links! The first one is already solved I think. In this proposal we plan to add the option for multiple email transport configuration. It's this point in the description:
The main goal is to switch to the new library but also open doors for the multiple transport feature to be implemented across the platform. The plugin looks great. It is a bit cumbersome to configure as it must fit in the existing Mautic configuration. So we can simplify that. And it is still based on Swiftmailer so it does not solve the main reason we need to refactor the email transport layer. |
OK, how can I help "to have different mailer for marketing and another for transactional emails." |
There will be no new features coming into Mautic 4. I'm not sure how you can help other than motivate or pay a developer to start working on this. |
@escopecz Probably we could start calculating approx hours for the tasks. People need to see how difficult it is... |
@kuzmany good idea. I'm currently in the middle of https://mautic.atlassian.net/browse/TPROD-428 and I'd like to finish it before starting something different. If anyone wants to start a project for this and split it into tickets, please go ahead. It would be appreciated. This is going to be one big blocker for the M5 release. |
Just a bit of (healthy?) copy & paste... sorry if you had already read this: What about implementing it in a way that the same "component" can be used by both M4 or M5 (or M6?). I mean, we need to get started with distributed architecture sooner rather than later, and email is like the cornerstone of Mautic, and there's so much that marketers need for Mautic email to be on par with other MA tools out there... |
It seems to me the solution currently proposed does a good job to further the current way email works in Mautic, but we could use this opportunity to improve it, both technically and functionally, among other things, by discussing the requirements with the community and even more specifically with who sends the freaking emails, the marketers! I understand would be harder and would take extra time, but it is not like we have a deadline for M5... or do we? |
This issue has been mentioned on Mautic Community Forums. There might be relevant details there: https://forum.mautic.org/t/dnc-transactional-emails/21619/12 |
@YosuCadilla I'll copy-paste the answer then:
Yes, there is a deadline. And it is in the past. M4 is running on dependencies with known security vulnerabilities. PHP 8.0 will stop getting security patches later this year. But that's not a discussion I want to have on this ticket. Please start your proposal so it can be reviewed. There's also going to be Mautic 6 in the future so you can start building the email micro service for M4, M5 and then it can be baked into M6. |
The deadline is whatever we make it to be, it was in the past and now it is in the future, basically undefined, and it could remain undefined, the world did not end when we missed the deadlines. Personally, I think it should rather be baked into M4, and fixing those vulnerabilities on M4 should be dealt with in M4, not pushed forward to M5. |
I do not know who made those decisions nor why, but we need to start thinking differently... It does not make any sense to produce yet another buggy version of Mautic when we can polish the current one which already works pretty damn well! Mautic is known to be buggy and difficult precisely because of that way of "solving" problems, we really need to start turning around this image, and we do that by prioritizing code quality over new versions. |
Solving the security vulnerabilities comes with beckward compatibility breaks. Are you saying we should not follow Semantic versioning? |
I have no idea what you follow or don't follow, it is hard to keep track really, maybe whatever versioning system you were using when you added those security fixes in the middle of major releases? |
This issue or PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you would like to keep it open please let us know by replying and confirming that this is still relevant to the latest version of Mautic and we will try to get to it as soon as we can. Thank you for your contributions. |
|
As the SwiftMailer library is dead and we must replace it with Symfony Mailer then this is a great opportunity to refactor the email sending in Mautic. This crucial part of Mautic has evolved in the years and each new feature added new
if
in the existing implementation. So the maintenance of this code is very costly and every change in the code can break some unrelated transport for example. The transport that support toketinzation (sending more than 1 email at once via API) use different code than SMTP-based transports. So debugging is complicated.Symfony Mailer can send only one email per request and this won't change in the future. See symfony/symfony#32991
There is WIP PR which removes SwiftMailer with Symfony Mailer: #11613
I suggest to improve this PR with more maintainable solution when we are forced to refactor it anyway.
What the system must support:
An iterable collection of recipients that can have 1 or several thousands or records.
DTO class that will hold the info we need to send a personalized email.
Wrapper DTO that will be used to send a batch email. Can be easily extended.
A factory that can check whether it supports a DSN and if so, create the transport with it.
The batch transports will have to implement this interface to send batch (and/or single) emails
Optional interface to handle bounces. It's not used anywhere in this example but will be implemented similarly like BatchTransportInterface for bounce requests.
Example of how we can use the classic Symfony transports that can use only 1 email per request.
Example of how we can implement our own batch transports that can send thousands of emails per request.
A collector that will be filled on cache build with transports that are ready to send emails. There are examples of 4 methods of how to get some specific transport. We may have 4 fields for primary, backup, marketing, transport DSNs in the configuration. If some is not configured then the primary will be used.
Autowiring the batch transports. Any new class implementing the BatchTransportInterface will be automatically tagged in
app/bundles/CoreBundles/Config/services.php
:Then in a new BatchTransportCompilerPass.php we'll do something like
Example usage of how to send a batch/segment email:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: