I have written code to login to the mail. How to get a response from the given link (https://nationalskillsregistry.com) in Gmail inbox?
import imaplib
import getpass
import email
import datetime
detach_dir = '.' # directory where to save attachments (default: current)
user = "something@gmail.com"
pwd = "password"
subject_filter='(SUBJECT "Daily News ")'
# connecting to the gmail imap server
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login(user,pwd)
print "logged in successfully..."
m.select()
typ, data = m.search(None, subject_filter)
for num in data[0].split():
rv, data = m.fetch(num, '(RFC822)')
if rv != 'OK':
print "ERROR getting message", num
#return
msg = email.message_from_string(data[0][1])
print msg.get_payload(decode=True)
m.close()
m.logout()
This is the mail which I have:
Subject : Daily News - Announcing
Body :
Kindly note, if you are making online payment you do not need to visit any POS centre. Your account will be immediately renewed. If your account is not renewed immediately then wait for 24 hours and check if the validity has been extended. Kindly do not make multiple online payments. Visit us at https://nationalskillsregistry.com.