1

i have code like this

Mailman::Application.run do
  to 'email@local.com' do
     ## how to get subject, from and body in here
  end
end

how to get subject, from and body from email in rails?

tardjo
  • 1,594
  • 5
  • 22
  • 38
  • You do not have your mailman application configured to poll an account for any incoming emails. Is that what you're attempting to do? – Tass Mar 30 '15 at 14:55

1 Answers1

0

Use mail gem https://github.com/mikel/mail/

Mailman::Application.run do
  default do
    mail = Mail.new(message)
    from = message.from.first
    content = mail.parts[1].body.decoded
    subject = message.subject
    //your other code

  end
end