I have problem with passing email fetched with Net::IMAP library to Mail object defined with mikel/mail gem.
I get mail with:
data = imap.uid_fetch(1, "BODY[]")
but how should I later put it into Mail.read convention?
mail = Mail.read(data.to_s)
seems to get Errno::ENAMETOOLONG: File name too long. It understands mail body as filename.
Any ideas?
Mail.read wants a filename. Use Mail.new to initialize a Mail object from an email source.
Also, fetch RFC822, not BODY[].
mail = Mail.new(imap.uid_fetch(1, "RFC822")[0].attr["RFC822"])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With