目标:使用python发送短信。
谷歌最终导致了 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()
当我将电话地址更改为有贝尔的人时,上面的代码有效。当是 Rogers 和 Fido 时,我可以在我的电子邮件帐户上看到已发送的消息,但 SMS 从未收到。shell中也没有弹出错误。
有谁知道为什么会这样?