my registered users can send each other proper emails (not private messages) through contact forms on their user profiles. When user A sends such an email to user B, I need user B to be able to reply to the email that was sent by A such that the two can start having an email conversation.

*) How can I encrypt the sender's and the recipient's email address such that the original email addresses of A and B are never revealed, even if the whole email conversation - after being initiated through the contact form - continues in their external email mailboxes?

Let me elaborate this a little bit further, even though I don't know if the path I am suggesting to take is at all feasible: To each user I assign a randomly generated key, e.g. 1k1 for user A and ki8 for user B. I would then set up the contact form on the profile of A such that every submission gets sent to [email protected]. Then, how can I make sure that every email going to [email protected] automatically gets forwarded to the actual email address of user A? If this could be done, I would simply replace the sender of this forwarded email with [email protected] and upon reply start over again.

  • 1
    Once a mail has been sent from Drupal, it will not control the way the communication happens in e-mails. Drupal can only modify the headers, body, addresses, etc. of the mail. Also I don't think this (encryption) might be possible. Even if it was, the mail provider would put the mail in spam folder if it could not verify the sender's email. And if you don't know who is mailing you, to which address would you reply?
    – AjitS
    Apr 9, 2013 at 12:52

2 Answers 2


Setting up a mail forwarding system would require a properly configured email server with access to the Drupal user tables. You could certainly configure a program like Exim to accept email for [email protected] and forward it to that users email address. The problem is one of authentication. You would somehow have to leverage Drupal's authentication system for the mail server. Not quite sure how to start that.

If you did not require authentication, then the mail server becomes an open relay for your domain and will probably end up on several blacklists.

I would recommend you just let this one go. Using contact forms, the recipient's email address remains unknown to the sender until the recipient replies. These are decisions your users make as they initiate and accept a conversation. Let them make the decision.

  • 1
    You don't think that Mailhandler module (drupal.org/project/mailhandler) could help?
    – deinqwertz
    Apr 9, 2013 at 13:23
  • @deinqwertz - No. The Mailhandler module is to use email for posting to the site, and the authentication methods are to allow users to post as themselves. Drupal is bootstrapped! Mailhandler is not for sending email, but for receiving it and publishing it on the site.
    – Triskelion
    Apr 9, 2013 at 13:34
  • I see, I was just thinking that if Mailhandler module lets you post to the site as yourself, why wouldn't it let you send (or "post") an email to another user in the name of Drupal?! In that case all emails would always be sent from [email protected] but maybe upon reply, Mailhandler - in combination with Rules - could read out incoming emails' subjects/contents and distribute them accordingly. But maybe I am also completely misunderstanding the concept of Mailhandler.
    – deinqwertz
    Apr 9, 2013 at 16:42
  • 1
    If you want your site to mediate the exchange, use private messaging. If you want the users to be able to use email, let them make the decision off the contact forms. If you set up email forwarding wihout authentication, spammers can send thousands of messages to your users and you become an open relay. With authentication, yours users will have to configure their email clients to your servers to use the service. The more complex you make it the less your users will like it. Keep it simple.
    – Triskelion
    Apr 9, 2013 at 17:14
  • That's a clear statement, and you are probably very right. Thanks for sharing your experience!
    – deinqwertz
    Apr 9, 2013 at 20:27

I think this is perfectly possible, though out of the scope of Drupal to some extent. Drupal can set from and reply_to headers in the mails sent out to, eg "John Doe <[email protected]>". You'd have to then set up a mail service on the domain which would receive any replies and forward them to the correct users. How you would configure the mail service is a matter for another forum, I think.

(I suggest you edit the original question to make it about obscuring or masking the original email address rather than encrypting it. What you describe is not really encryption.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.