Category Archives: Tech

How To Retrieve Blocked Gmail Attachments

If you’re like me, then you constantly find yourself sending email attachments to yourself as a mode of backup for miscellaneous files. And if you use Gmail, there will be instances when you can’t retrieve those attachments because Gmail blocks downloads of potentially harmful files.

Though Gmail does prevent you from attaching those potentially harmful files (like *.exe) to begin with, they do manage to slip past the upload scan at times, especially if they’re compressed. This is fine so long as you’re still able to download them, but sadly that isn’t always the case.

So what do you do when you need to download a backup file that Gmail has blocked you from downloading, and you’ve lost the original? Luckily, there is a workaround and all is not lost. I will demonstrate with an example below, where I needed to retrieve a *.rar file that contained an executable file.

0

1. Firstly, download Python v3.4.2 from here. Once you’ve downloaded the file, install the program by running the file and following the on screen instructions.

1

2. Open your email, and click on Show original from the drop-down menu.

2

3. A pop-up will appear with what appears to be garbled text. This is actually your email and attachment as a text file, encoded in base64. We will use a Python script to convert it back to binary. Copy the entire text to clipboard (Ctrl+A, Ctrl+C).

3

4. Paste it in a text file and save it with any generic name ending in *.txt.

4.5

5. Do the same for the script file, copy the script below:

6. Paste it in a text file.

5

7. Save it in the same folder with any generic name ending in *.py and Python should automatically recognise it as a Python script. If you can’t modify the file extension, you have to unhide known file extensions in Windows Explorer.

6

8. Run the Python script, and press Enter when prompted.

7

9. Depending on the file size, the attachment should appear immediately in the same location as the script and text file.

8

That’s it. The script works with Python 3.4.2 and can process multiple files and warns before overwriting anything.

Credits to Stefan for providing the script.