We have two web_shops on the same database each selling a different sets of products.
Sales of each web_shop are imported to tryton to generate shipments and invoices.
For each web_shop, we have a different set of reports with the branding of each domain.
We will like to setup automatic delivery of such reports to the customer using notification email module. We have two different SMTP credentials to access each domain but I see only a single configuration for email uri.
How can we setup two different smtp servers for notifications?
You can use the same SMTP server to send email from 2 different domains.
The notification email module allows you to define the From for each notification.
One improvement could be to permit to use more domain in set_from_header than just the sender domain. But for now you can use a generic sender and two different From.
So you have two servers (bare metal, VM etc), and each is sending email for just one domain? I’m struggling if it is worth the time and effort to implement such thing in Tryton or just spin up a container with postfix which can handle multiple domains. It’s very easy to setup and can be easily extended with more domains. You just send the email to postfix and it will deliver it to the right mail server based on the domain part of your email.
No, we have a single tryton instance managing two web shops with each different domains.
Each domain has its own stmp server which is externally managed.
So I need to send the notification for each web shop using each SMTP server, username and password.
Just drop a postfix mailserver in between. Your Tryton instance is sending the mail to postfix with the right From address. Postfix will then send the email to the right smtp server based on the domain of your From address. When you run Tryton on a Unix/Linux, chances are high that postfix already is installed. Just some configuration is needed.
What worked for me was using a custom module that allowed for multiple SMTP configurations based on certain criteria, like the domain name.You could check out options like modifying the notification email module or creating a small custom script that handles the logic of switching SMTP settings based on the shop. It might take a bit of coding, but it pays off when the right reports go out under the right branding.Also, when handling customer emails, keeping everything secure is crucial. I found this tool where you can go to site to check email safety. It really helped me ensure my lists were clean, which gave me peace of mind knowing I wasn’t sending emails to compromised addresses.