4

I'm parsing an email using the below style

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

How would I get a value of the 'reply-to' field if it exists? Can the gem do this?

Tarang
  • 75,157
  • 39
  • 215
  • 276

1 Answers1

10

You want the reply_to method:

message.reply_to
# => ["user@example.com"]

If there was no reply-to set, it'll be nil:

message.reply_to
# => nil

I'd recommend looking through the RDoc documentation, specifically for the Message object. This will show you all of the methods available on your message instance.

Dylan Markow
  • 123,080
  • 26
  • 284
  • 201