SMTP Relay - virtual domain
by KamilKrK from LinuxQuestions.org on (#4T3P1)
Hello for the first time
He started with a difficult topic right away from me.
I need help configuring SMTP Relay to work like the SMTP_Relay.JPG schema.
I mean exactly that it would be possible to configure SMTP Relay in such a way that depending on what e-mail address will get the message redirected to the appropriate mail server and account. However, I take into account that if you can't do the rule on the email address only on the domain then you will have to do it.
Additionally, for one of the mechanisms it needs authorization.
This is a strange case because the program tells you to enter the login and password for the SMTP service so that you can save the settings, but unfortunately it does not work with the O365 service, therefore in this case it also needs SMTP Relay.
Mechanism description:
1. A message is sent to SMTP Relay from mail address @ domain1.com. SMTP Relay recognizes the email address @ domain1.com and knows that it should route this message to the GMAIL mail server at 123 @ gmail.com.
2. A message is sent to SMTP Relay from the address mail1 @ domain2.com. Authorization to SMTP Relay is done via login and password and is sent on port 587/465. SMTP Relay recognizes the address mail1 @ domain2.com and knows that it is to forward this message to the O365 mail server to the address mail1 @ ourdomain.com.
3. A message is sent to SMTP Relay from mail2 @ domain2.com. SMTP Relay recognizes the address mail2 @ domain2.com and knows that it is to forward this message to the GMAIL mail server to address 456 @ gmail.com.
4. A message is sent to SMTP Relay from mail address @ domain3.com. SMTP Relay recognizes the email address @ domain3.com and knows that it is to forward this message to the O365 mail server to the address mail2 @ outdomain.com.
5. A message is sent to SMTP Relay from the address @ domain4.com. SMTP Relay recognizes the mail address @ domain4.com and knows that it is to forward this message to the O365 mail server to mail2 @ outdomain.com.
https://ibb.co/Q7g1ZMK
In each of the above cases, SMTP Relay is authorized with accounts (O365, GMAIL) by login and password and the appropriate port.
I tried solving the virtual domain but unfortunately it didn't work for some reason.
Has anyone tried to extend SMTP Relay to the above requirements and is it even possible?
Please help.


He started with a difficult topic right away from me.
I need help configuring SMTP Relay to work like the SMTP_Relay.JPG schema.
I mean exactly that it would be possible to configure SMTP Relay in such a way that depending on what e-mail address will get the message redirected to the appropriate mail server and account. However, I take into account that if you can't do the rule on the email address only on the domain then you will have to do it.
Additionally, for one of the mechanisms it needs authorization.
This is a strange case because the program tells you to enter the login and password for the SMTP service so that you can save the settings, but unfortunately it does not work with the O365 service, therefore in this case it also needs SMTP Relay.
Mechanism description:
1. A message is sent to SMTP Relay from mail address @ domain1.com. SMTP Relay recognizes the email address @ domain1.com and knows that it should route this message to the GMAIL mail server at 123 @ gmail.com.
2. A message is sent to SMTP Relay from the address mail1 @ domain2.com. Authorization to SMTP Relay is done via login and password and is sent on port 587/465. SMTP Relay recognizes the address mail1 @ domain2.com and knows that it is to forward this message to the O365 mail server to the address mail1 @ ourdomain.com.
3. A message is sent to SMTP Relay from mail2 @ domain2.com. SMTP Relay recognizes the address mail2 @ domain2.com and knows that it is to forward this message to the GMAIL mail server to address 456 @ gmail.com.
4. A message is sent to SMTP Relay from mail address @ domain3.com. SMTP Relay recognizes the email address @ domain3.com and knows that it is to forward this message to the O365 mail server to the address mail2 @ outdomain.com.
5. A message is sent to SMTP Relay from the address @ domain4.com. SMTP Relay recognizes the mail address @ domain4.com and knows that it is to forward this message to the O365 mail server to mail2 @ outdomain.com.
https://ibb.co/Q7g1ZMK
In each of the above cases, SMTP Relay is authorized with accounts (O365, GMAIL) by login and password and the appropriate port.
I tried solving the virtual domain but unfortunately it didn't work for some reason.
Has anyone tried to extend SMTP Relay to the above requirements and is it even possible?
Please help.