how to get subject, from and body from mailman rails

227 views Asked by At

i have code like this

Mailman::Application.run do
  to '[email protected]' do
     ## how to get subject, from and body in here
  end
end

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

1

There are 1 answers

0
Chaudhari Parbat On

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