![](/img/trans.png)
[英]Python SMTP - Receive email in Sent Items after email is sent to user
[英]How to check if email was sent using smtp in python 3.7
我正在使用smtplib
使用sendmail()
function 發送電子郵件,如何知道 email 是否已發送,因為 ZC1C425268E68385D1AB5074C17A94F14 沒有返回響應代碼
import smtplib
s = smtplib.SMTP('smtp-mail.outlook.com', 587)
s.starttls()
s.login('myemail@outlook.com', 'mypassword')
s.sendmail('myemail@outlook.com', 'theotheremail@domain.com', 'message')
s.quit()
從文檔中:
如果至少有一個收件人接受了郵件,此方法將正常返回。 否則會引發異常。 也就是說,如果此方法沒有引發異常,那么應該有人會收到您的郵件。 如果此方法沒有引發異常,它會返回一個字典,其中每個被拒絕的收件人都有一個條目。 每個條目都包含一個由服務器發送的 SMTP 錯誤代碼和隨附錯誤消息的元組。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.