Sahil Grover
Sahil Grover

Reputation: 1915

How to show to whom email was originally destined in rails?

I have a system which receives and send mails to the various members in a group.

Lets say I have a group [email protected] which have members

  1. [email protected]
  2. [email protected]

and so on..

Same way there is another group [email protected] which have members

  1. [email protected]
  2. [email protected]

and so on..

When I get any mail for [email protected] it is forwarded to it's member and same way for [email protected].

mail :from => the_person_who_sent_mail,
     :to => members_email_id,
     :subject => mail_subject,
     :reply_to => [email protected]

And it appears like mail was sent to me.

But I want to do a change in this as shown below :

When it lands in my inbox it should be something like

From     :  [email protected]
Reply To :  [email protected]
To       :   [email protected]

But according to my setting it comes like

From     :  [email protected]
Reply To :  [email protected]
To       :   [email protected]

In my case it shows that the mail is destined to me. But in the first case it shows to whom the mail was originally destined for.

Upvotes: 4

Views: 81

Answers (1)

Benjamin
Benjamin

Reputation: 749

Mailing list servers accomplish this with BCC, like so:

mail :from => the_person_who_sent_mail,
     :to => [email protected],
     :subject => mail_subject,
     :reply_to => [email protected],
     :bcc => [members_email_id]

The downside to this is that your mailserver will actually attempt to send the e-mail to [email protected], so it will have to know to ignore this message. However, when the message arrives in the user's inbox, the To: will be [email protected].

Upvotes: 1

Related Questions