开发者

Write Net::IMAP email to mikel/mail email

开发者 https://www.devze.com 2023-03-03 12:17 出处:网络
I have problem with passing email fetched with Net::IMAP library to Mail object defined with mikel/mail gem.

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"])
0

精彩评论

暂无评论...
验证码 换一张
取 消