Sunday, August 17, 2014

Fetching Email on Top of your Gmail Account

This is my first post writing code in this blog. In this post, I am going to to share a couple of lines of code, very simple yet powerful enough to fetch the Email at the top of your G Mail Inbox. The code has been pasted in Pastebin and the link to the code is:
Below is given the code. You are allowed to try it out and even do something extra with this piece of code: 

import imaplib
uemail=raw_input("Enter your Email::")
password=raw_input("Enter your Password::")
status,data=mailserver.fetch(count[0],"UID BODY [TEXT]")
print data[0],[1]

Now, here's the working of the code:
imaplib is a file in your Python Libraries that lets you access imap
imap stands of Internet Message Access Protocol that allows you to retrieve and store messeges from your Email Account. Here we are using imap to access Gmail Account and retrieve a mail.
IMAP4 is the latest imap version and SSL  is a protocol to transfer private data to the internet and 993 is the IMAP port of G Mail. uemail and password are two variables storing data entered in them.
mailserver is the server of the Email Host, here in the case its G Mail.
Even I don't know what does this status does. count is a counting variable.
print prints the data. 
close is for closing the G Mail server.

Thursday, August 14, 2014

Getting Started With Python

I am beginning to learn python. Since the past 6 or seven months, I am trying to learn this programming language but  have been a failure in it. I never took it seriously. Everyone says it is easy to learn but, I cannot go up from the basics of it. 
    I created this blog so that I can post all the stuffs that I have done using python from today(August -14,2014). This way, I believe that I can remember what I have been learning and also share something new to other newbie beginners. 
   My Solo motive of creating this blog is to put all the codes that I have written and what it does. I have not made it in any education purpose. So, no one can complain me or insult me saying that I don't know much about Python. I am a beginner and trying to learn new things.
Today, I will try out something about extracting the email on the top from my G Mail Account. 

Note: The codes written will be in Courier New font and the rest of the descriptions will be in Trebuchet font.

Finally, In the end.

Python is Fun!