How to send email notification when colab processing is complete

Viewed 3111

I have a Colab task for data processing.

I want to send a Gmail notification when this task is finished.

Can anyone help me?

1 Answers

You can use smtplib to send an email. For more details goto this link.

import smtplib

sender = 'from@fromdomain.com'
receivers = ['to@todomain.com']

message = """From: From Person <from@fromdomain.com>
To: To Person <to@todomain.com>
Subject: SMTP e-mail test

This is a test e-mail message.
"""

try:
   smtpObj = smtplib.SMTP('mail.your-domain.com', 25)
   smtpObj.sendmail(sender, receivers, message)         
   print "Successfully sent email"
except SMTPException:
   print "Error: unable to send email"
Related