如何从邮递员轨道获取主题,来自和身体

时间:2013-10-22 04:04:36

标签: ruby-on-rails mailman-gem

我有这样的代码

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

如何从电子邮件中获取主题,来自和身体?

1 个答案:

答案 0 :(得分:0)

使用邮件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