Sometimes you see following message in gmail:
and you can't download attached file
Follow steps to download file:
1. Open original message as shown in image
let's name it download_original.txt
3. Save following python script in same directory. Let's name it import_file.py
import email
import sys
if __name__=='__main__':
if len(sys.argv)<2:
print "Please enter a file to extract attachments from"
sys.exit(1)
msg = email.message_from_file(open(sys.argv[1]))
for pl in msg.get_payload():
if pl.get_filename(): # if it is an attachment
open(pl.get_filename(), 'wb').write(pl.get_payload(decode=True))
4. Go to Python console
If you are using MAC book or Linux OS - open terminal and type python
type
python import_file.py download_original.txt
It will download your blocked file in same directory.
That's it.
Thanks!!! Enjoy Programming :)
References:
https://spapas.github.io/2014/10/23/retrieve-gmail-blocked-attachments/
Comments
Post a Comment
Thanks for your valuable comments.