Skip to content

Instantly share code, notes, and snippets.

@weldan
Created November 4, 2015 03:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weldan/a8d09ad59f391f1e939c to your computer and use it in GitHub Desktop.
Save weldan/a8d09ad59f391f1e939c to your computer and use it in GitHub Desktop.
hogo.py
#weldan@ium.com.my 4/11/15
from gmail import gmail
def download():
g = gmail.login("cs@integralogistic.com.my", "xxxxxx")
if g.logged_in:
hogo = g.label("Hogo").mail()
count = 0
for h in hogo:
count += 1
h.fetch()
f = open("hogo"+str(count)+".txt", "w")
if h.fr:
f.write("From: "+h.fr+"\n")
if h.to:
f.write("To: "+h.to+"\n")
if h.cc:
f.write("CC: "+h.cc+"\n")
if h.body:
f.write("Message: "+h.body+"\n")
f.close()
print "8===========================D\n"
print "hogo"+str(count)+" downloaded.\n"
print "8===========================D\n"
if __name__ == "__main__":
download()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment