我写了一个函数,从gmail帐户给verizon手机发短信,登录到smtp服务器时遇到问题。函数如下所示:
def _text(fromwhom,number,text):
"""
A private function which sends an SMS message to a cell phone number.
Parameters
----------
fromwhom : string
The email address sending the alert: "testing@gmail.com"
number : string
The user-provided cell phone receiving the job alert.
text : string
The content of the job alert.
"""
server = smtplib.SMTP( "smtp.gmail.com", 587 )
server.starttls()
server.login(account_email, account_pw)
server.sendmail( '{}'.format(fromwhom), '{}@vtext.com'.format(number), '{}'.format(text) )
server.quit()
有人知道为什么会失败吗?我尝试过很多电子邮件和密码(都是我自己的账户),每次都失败。这是在谷歌那边发生的吗?在
默认情况下,gmail的POP3/IMAP/SMTP服务器不是无障碍。如果要使用它们,必须手动打开它们。在
相关问题 更多 >
编程相关推荐