colab处理完成后如何发送电子邮件通知

问题描述 投票:0回答:1

我有一个Colab任务,用于数据处理。

我想在完成此任务后发送Gmail通知。

有人可以帮我吗?

email google-colaboratory
1个回答
0
投票

您可以使用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"
© www.soinside.com 2019 - 2024. All rights reserved.