Tuesday, 18 July 2017

Gmail: Download blocked file


Hi, today we are going to learn, how to download blocked file in gmail.

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

2. Download Original

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"

    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


python   import_file.py    download_original.txt

It will download your blocked file in same directory.

That's it.

Thanks!!! Enjoy Programming :)



Friday, 14 July 2017

Blogger: Set subdomain for blog using Cloudflare

If you want to point you blog hosted at blogspot.com to subdomain like http://blog.xxxx.com using Cloudflare, following are the steps:

1. Go to Basic Settings of your blog

2. Click on Third-party domain settings under Publishing

3. It will ask you to add two CNAME entries under your DNS settings. You can add as follow in Cloudflare

4. Set domain in your blog settings as http://blog.xxx.com. Save.

That's it. Sometimes it reflects immediately, sometimes it takes 24 to 48 hours as well.

Thanks!!!!!!!!!! Enjoy Programming!! :)