Forum: Ruby on Rails Email Anonymization

Posted by Nick Colgan (Guest)
on 2011-10-19 09:25
(Received via mailing list)
I'm working on an email anonymization feature for my rails app (kind of 
like
craigslist). I've configured postfix to pipe all emails addressed to
user-*@example.com (i.e. user-1234@example.com, where 1234 is the user 
id in
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 
the
database (if not: return), then anonymize/mask it; so if jdoe@foobar.com 
is
the sender and user 24 has that email address, change the sender's 
address
to user-24@example.com. Then, parse the recipient's email address and 
unmask
it (change user-23@example.com to user 23's real email address) so it 
can be
delivered properly.

The thing is, I'm not an expert at email/email headers. What's the best 
way
to go about this. Directly alter the message's FROM address and TO 
address
and deliver it? Create a new email in rails, set FROM to an address 
owned by
the server and the REPLY-TO header to the sender's masked address and 
the TO
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
don't exist?

Any help would be appreciated.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.