ruby'mikel/mail'回复字段

Aks*_*hat 4 ruby email ruby-on-rails mail-gem

我正在使用以下样式解析电子邮件

message = Mail.new(body)   #where body is the RAW source from the email server
message.subject #=> the subject of the message as a string
message.from #=> shows who the email is from
Run Code Online (Sandbox Code Playgroud)

如果存在,我如何获得'reply-to'字段的值?宝石可以这样做吗?

Dyl*_*kow 10

你想要的reply_to方法:

message.reply_to
# => ["user@example.com"]
Run Code Online (Sandbox Code Playgroud)

如果没有回复集,它将是零:

message.reply_to
# => nil
Run Code Online (Sandbox Code Playgroud)

我建议查看RDoc文档,特别是Message对象.这将显示您的message实例上可用的所有方法.