Felix Felix - 1 year ago 73
Ruby Question

Rails Mail gem finding out recipient

I collect all Mails from a pop server with Mail.all

@currentmails = Mail.all
# Über alle Mails im Postfach Iterieren
@currentmails.each do | mail |
puts mail.to

But mail.to doesn't work ... I got this error:

NoMethodError: undefined method `gsub' for ["mail@HOST.de"]:Mail::AddressContainer

Mail Recipient (to) Looks like this:

<To: <mail@HOST.de>>

Answer Source


is the solution of the problem.