Back to articles
10 Python Automation Scripts That Save Me 10+ Hours Per Week

10 Python Automation Scripts That Save Me 10+ Hours Per Week

via Dev.to PythonKaihua Zheng

10 Python Automation Scripts That Save Me 10+ Hours Per Week I'm obsessed with automation. If I do something more than twice, I write a script. Here are 10 Python scripts I use daily that save me over 10 hours per week. Each one is under 50 lines and ready to use. 1. 📧 Auto-Reply to Emails import imaplib import email import smtplib from email.mime.text import MIMEText def auto_reply ( imap_server , smtp_server , email_addr , password ): # Connect to inbox mail = imaplib . IMAP4_SSL ( imap_server ) mail . login ( email_addr , password ) mail . select ( ' inbox ' ) # Find unread emails _ , messages = mail . search ( None , ' UNSEEN ' ) for msg_id in messages [ 0 ]. split (): _ , msg_data = mail . fetch ( msg_id , ' (RFC822) ' ) msg = email . message_from_bytes ( msg_data [ 0 ][ 1 ]) sender = email . utils . parseaddr ( msg [ ' From ' ])[ 1 ] subject = msg [ ' Subject ' ] # Smart auto-reply reply = MIMEText ( f " Thanks for your email about ' { subject } ' . " f " I ' ll get back to you w

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
22 views

Related Articles