Download Gmail Blocked Email Attachments

Hits: 508  

Anti-virus warning – 1 attachment contains a virus or blocked file. Downloading this attachment is disabled.


Gmail says …. File types you can’t include as attachments

I know my zip file “” have .JS files

Note: Gmail warned you that attachment is not safe. So make 100% sure that email attachments is safe for download before follow below process.


Click on email option “Show original”, it will open a new browser window with MIME encoded message. Now you have to “Download Original” OR “Copy to clipboard” save text file “original_msg.txt”

In file “original_msg.txt” you can find attached file name

Content-Type: application/zip; name=””
Content-Disposition: attachment; filename=””
Content-Transfer-Encoding: base64
X-Attachment-Id: f_iqui8p0t0

Create new Python script named “” and write below code in it

import email
import sys

if __name__=='__main__':
    if len(sys.argv)<2:
        print "Please enter a file to extract attachments from"

    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))

D:\>python –version
Python 2.7.6

D:\>python original_msg.txt

You will find zip file attachment “” in the same folder!

You can also open Mime Encoded Text file “original_msg.txt” in Outlook or any email client just rename it to “original_msg.eml” then open email file and download attachment.

Suggestion: If your files are safe, you can upload the file to Google Drive, then send shareable link as Drive attachment.

Extract attachments from emails that Gmail doesn’t allow you to download.

JSON2CSV – convert json files to csv

Hits: 8212  

JSON2CSV is a python script that converts json data to a csv file.



Download above text file “json2csv.py_.txt” then rename “”

>> python “input.json” “output.csv”

JSON – input.json

“createdAt”: “2014-02-20T18:15:56.818Z”,
“fbID”: “34534534534”,
“lessonQuestions”: 5,
“lessonScore”: 2750,
“lesson_no”: 2,
“objectId”: “htmsuPr6F6”,
“updatedAt”: “2014-02-22T15:42:38.166Z”
“createdAt”: “2014-02-21T16:45:52.550Z”,
“fbID”: “100001132788807”,
“lessonQuestions”: 5,
“lessonScore”: 1100,
“lesson_no”: 3,
“objectId”: “xgmJxEyBHl”,
“updatedAt”: “2014-02-22T18:14:38.107Z”

CSV – output.csv

createdAt, fbID, lessonQuestions, lessonScore, lesson_no, objectId, updatedAt
2014-02-20T18:15:56.818Z, 34534534534, 5, 2750, 2, htmsuPr6F6, 2014-02-22T15:42:38.166Z
2014-02-21T16:45:52.550Z, 100001132788807, 5, 1100, 3, xgmJxEyBHl, 2014-02-22T18:14:38.107Z