On 9. februára 2025 21:32:54 UTC, John Levine via mailop <[email protected]>
wrote:
>Tip: the media type is sometimes wrong so you're better off sniffing the first
>few bytes of the attachment to see what format it is. No, they shouldn't do
>that
>either. But they do.
In Python:
if c_content[:3] == b"\x1f\x8b\x08":
# GZIP content
...
elif c_content[:4] == b"\x50\x4b\x03\x04":
# ZIP content
...
elif c_content[:19] == b'<?xml version="1.0"':
# XML content
...
Hope it helps someone...
regards
--
Slavko
https://www.slavino.sk/
_______________________________________________
mailop mailing list
[email protected]
https://list.mailop.org/listinfo/mailop