I’m working on an email anonymization feature for my rails app (kind of
craigslist). I’ve configured postfix to pipe all emails addressed to
firstname.lastname@example.org (i.e. [email protected], where 1234 is the user
the database) into rails via the mailer’s receive method.
Now, the idea is to first check that the sender’s email address is in
database (if not: return), then anonymize/mask it; so if [email protected]
the sender and user 24 has that email address, change the sender’s
to [email protected] Then, parse the recipient’s email address and
it (change [email protected] to user 23’s real email address) so it
The thing is, I’m not an expert at email/email headers. What’s the best
to go about this. Directly alter the message’s FROM address and TO
and deliver it? Create a new email in rails, set FROM to an address
the server and the REPLY-TO header to the sender’s masked address and
header to the recipient’s unmasked address? How do I handle multiple
recipients? What’s the best way to handle emails directed to users that
Any help would be appreciated.