We've got this great video transcoder that accepts files from all sorts of sources (including email). The problem I have is that in order to do this it implements an SMTP server which you're supposed to then send email to. I don't want to have to open up ports to make this thing visible from the outside, plus I can't easily use an email belonging to an existing domain that's already got MX records pointing to our main SMTP servers.
Simple, I thought, use fetchmail to grab the emails from the internal POP3 server and deliver to the smtp server on the transcoder. I can also masquerade the email address to make it easier to remember (the transcoder requires a specific syntax which has to include a valid username for the system).
Now here's the problem, the public-facing email address is (for example)
[email protected], the transcoder expects it to be
[email protected]. From looking at the session between fetchmail and the transcoder it writes the RCPT TO: to the correct email (
[email protected]) but the contents of the email contain a To: header for
[email protected]. Looking at the transcoder's logs it's this header that the transcoder uses to determine who the mail is for.
Bearing in mind this thing needs to run as a daemon, is there a simple (or complicated) way to rewrite this To: header to point to the right address?