my net house


A reusable function

def fetch_uids(address,password,folder,d):
mail = IMAP4_SSL(‘’)
mail.login(address, password)
interval = (“%d-%b-%Y”)
result, data = mail.uid(‘search’, None,'(SENTSINCE {date})’.format(date=interval))
return data



Now I can define variables according to my project and using the function call I can make my function more reusable:

for daily analysis inbox I can call:



for daily analysis sentbox I can call:


Same as I can change the value of ‘days’ which make more sense.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: