我有一个Colab任务,用于数据处理。
我想在完成此任务后发送Gmail通知。
有人可以帮我吗?
您可以使用smtplib
发送电子邮件。有关更多详细信息,请转到此link。
import smtplib
sender = '[email protected]'
receivers = ['[email protected]']
message = """From: From Person <[email protected]>
To: To Person <[email protected]>
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"