Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get the name of attachment files without downloading #125

Open
soyapark opened this issue Apr 12, 2019 · 4 comments
Open

get the name of attachment files without downloading #125

soyapark opened this issue Apr 12, 2019 · 4 comments
Assignees
Labels

Comments

@soyapark
Copy link
Member

soyapark commented Apr 12, 2019

https://stackoverflow.com/a/13848096

we could use this to provide a feature of has_attachment() or listing names of attachments

@soyapark soyapark changed the title get the name of attachement files without downloading get the name of attachment files without downloading Apr 12, 2019
@lukesmurray lukesmurray self-assigned this Apr 27, 2019
@lukesmurray
Copy link
Collaborator

Found the following information here

You have 2 options when it comes to handling attachments.

One is that you download the entire raw message (using the "RFC822" fetch item) and then parse it using a separate package such as email.parser in the Python standard library. This takes care of splitting up the raw message into parts and handles much of the low level details for you. The downside of this approach is that it requires you download the entire message, even if you only care about some parts of it.

The other approach is to use the IMAP fetch command's abilities to download specific message parts. With this approach you would first fetch the "BODYSTRUCTURE" for a message which gives details of the (often nested) parts of an email on the server. This would then be used to drive fetches of specific parts (e.g. "BODY[3.1]". This is somewhat more complicated but can be much more efficient in terms of bandwidth usage.

The relevant parts in the IMAP RFC are https://tools.ietf.org/html/rfc3501#section-6.4.5 and https://tools.ietf.org/html/rfc3501#section-7.4.2.

@lukesmurray
Copy link
Collaborator

@lukesmurray
Copy link
Collaborator

also page 73 of this

@lukesmurray
Copy link
Collaborator

lukesmurray commented May 26, 2019

fixed by #175

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants