This is my python code which I m using to send email to Gmail using SMTP import smtplib from email.mime.text import MIMEText subject = "Email Subject" body = "This is the body of the text message" sender = '#####@gmail.com' recipients = '####@gmail.com' password = '######' # Note: App password for 2FA def send_email(subject, body, sender, recipients, password): msg = MIMEText(body) msg['Subject'] = subject msg['From'] = sender msg['To'] = ', '.join(recipients) try: with smtplib.SMTP('smtp.gmail.com',587) as smtp_server: smtp_server.ehlo() smtp_server.starttls() smtp_server.login(sender, password) smtp_server.sendmail(sender, recipients, msg.as_string()) print("Message sent!") except: print("Unable to send email") send_email(subject, body, sender, recipients, password) The operation is getting timed out Need pointers if I m doing something wrong I m referring this -https://mailtrap.io/blog/python-send-email-gmail/ Continue reading...