Hello my fellow Linux people -
I’m looking for advice on setting up email routing from one 3rd party service to another. The first service is an external ticketing service and the second is an SMTP service.
Multiple clients contact us through the ticketing system. When they create tickets an email is generated and sent to them. Currently, the ticketing system connects to the 3rd party SMTP service and sends an email “On Behalf Of” a stock user on the ticket creators domain, but the actual “From: address” isn’t from their domain.
So - I would like to put a relay between the two and “route” the emails to the external email address in such a way that the “From” address shows the ticket requestor’s domain.
In other words, let’s say that there are 3 companies who use the ticketing system: @companyA.com, @companyB.com, and @compnayC.com. When a person from @companyA.com creates a ticket, it goes to the relay server, which then constructs and email with a “From:” address @companyA.com and sends it through the 3rd party SMTP service.
Ok - now that we got that out of the way, I’ll describe how the 3rd party SMTP service works. You’re able to ‘connect’ to the service through a single FQDN (smtp.emailService.com). You can send emails through it using python for example, by using the smtplib and providing a username and password and then sending an email you’ve constructed. The connection portion is very similar if you connect a script to smtp.gmail.com, however you can construct the headers/etc with this service.
Anyway, I think I can do this with postfix, but I’m not sure how to create the “personalized” email domains depending on the address postfix receives it from. Maybe there’s transport mapping I can do, but it seems like there’s gotta be some logic to do the mapping. Therefore, I was looking into how to create an SMTP relay with Python, and figure out how to do the logic from there.
Any advice on this?