【发布时间】:2020-06-18 05:31:55
【问题描述】:
目标:使用 python 发送短信。
Google 最终引出了 smtp 库然后我的代码变成了:
import smtplib
import imaplib
import email
#emailAddress = "email@gmail.com"
#emailPassword = "appPassword"
#phoneAddress = "number@sms.rogers.com"
from config import emailAddress, emailPassword, phoneAddress
message = "testing test test"
smtpServer = "smtp.gmail.com"
server = smtplib.SMTP_SSL(smtpServer, 465)
server.ehlo()
server.login(emailAddress, emailPassword)
server.sendmail(emailAddress, phoneAddress, message)
server.quit()
当我将电话地址更改为 Bell 的人时,上面的代码有效。当是 Rogers 和 Fido 时,我可以在我的电子邮件帐户上看到已发送的消息,但 SMS 从未收到。 shell中也没有弹出错误。
有人知道为什么会这样吗?
【问题讨论】:
标签: python sms smtplib carrier