How do I get the original sender from a forwarded email using Rails 3 mail gem?
I am trying to forward email into my Rails3/Ruby 1.9.2 app and I need to get the sender's email address.
Anyone k开发者_运维问答now how to do this with new Rails 3 mail?
Also can I get the time received or sent from the sender?
According to the docs here
You should just be able to call
mail.envelope_from
Normally the forwarding mail server will pass on the address it's forwarding for as a header. At CloudMailin we are experimenting with passing the header x-forwarded-for which google and some other servers add. It's not garaunteed but if your server sets a header and your only using one it will be consistent so you can rely on it being there.
精彩评论