Sending email for two different domains

Hi,

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.

I guess you are propsing to setup a local smtp server which relays mails to multiple domains as described here:

https://medium.com/geekculture/configuring-postfix-for-multi-domain-mail-relay-d33cd236298a

Am I right?

Not necessary, there is no need for a relay to send from a server using two different domains.

Main problem is that we do not control the servers sending the emails.We just have the credentials to conect to them.

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.

Edit:
It’s an old article Setup Postfix to Relay Mail for Specific Domains or Users - Mad9Scientist.com but it shows how easy it is. The only thing it is missing, is the login part (sasl_passwd) with the mail servers you don’t control.

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.

You can configure Amazon AWS SES or any similar service and send e-mails for as many domains as you wish with just one set of credentials.

The manager of the domain will only need to add some entries to their DNS server.

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.