Receive email body without extracting attachments using ruby ​​mail

I am trying to get the gmail body using IMAP and ruby ​​mailbox. It works fine when I get the RFC822 field as described in another answer. . Fiddle described the approach very well to answer a similar question.

This approach is great, except that it requires a sample of RFC822, which also extracts all attachments. Is there any other area or any other approach that I can take to not receive attachments, but still use a ruby ​​postal stone to get a beautifully decoded body?

+6
source share
1 answer

You need to parse and understand the actual structure of the BODYSTRUCTURE response BODYSTRUCTURE , see RFC 3501, p. 56 . Also, do not forget to apply the appropriate Content-Transfer-Encoding (for example, base64 or quoted-printable ) and use the correct encoding of the set (the charset parameter of the Content-Type header of each part of the body). All this information is included in the BODYSTRUCTURE response; refer to the documentation of your library to find out how to access it.

0
source

Source: https://habr.com/ru/post/947136/


All Articles