-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathemail.py
More file actions
26 lines (24 loc) · 787 Bytes
/
email.py
File metadata and controls
26 lines (24 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import poplib
import getpass
import pyttsx
mailServer = 'pop.googlemail.com'
emailID = 'siddharth1998.ra@gmail.com'
emailPass = 'papama#1'
#Open connection to mail server(Secured using SSL)
myEmailConnection = poplib.POP3_SSL(mailServer,'995')
#Print the response message from server
print myEmailConnection.getwelcome()
#Set email address
myEmailConnection.user(emailID)
#Set password
myEmailConnection.pass_(emailPass)
#Get information about the email address
EmailInformation = myEmailConnection.stat()
print "Number of new emails: %s (%s bytes)" % EmailInformation
#Reading an email
print "\n\n====\nRead Messages\n====\n\n"
#Reading all emails
numberofmails = EmailInformation[0]
for i in range(numberofmails):
for email in myEmailConnection.retr(i+1)[1]:
print email