Is it possible to check if an email contains an attachement just from the e-mail header?

StackOverflow https://stackoverflow.com/questions/3676344

  •  01-10-2019
  •  | 
  •  

문제

I am developing an email client in Python.

Is it possible to check if an email contains an attachement just from the e-mail header without downloading the whole E-Mail?

도움이 되었습니까?

해결책

"attachment" is quite a broad term. Is an image for HTML message an attachment?

In general, you can try analyzing content-type header. If it's multipart/mixed, most likely the message contains an attachment.

다른 팁

Try IMAP4.fetch(message_set, "BODYSTRUCTURE")

Read the RFC3501 for details about the FETCH BODYSTRUCTURE response.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top