admin管理员组文章数量:1335107
I wrote the following code to send a text message from my python script. The first time I ran it I successfully received a text message to my phone, but it was blank (no message). I re-ran the code 3 times and now get no message, however I noticed the messages are in the outbox of the email (though the recipient phone number is in BCC instead of recipient). I also attempted sending the message straight from email instead of from the python script and no message arrived.
Can you please offer me ideas to try to debug why the code malfunctioned once, and then ceased to function there after?
def send_message(phone_number, carrier, message):
CARRIERS = {
"att": "@mms.att",
"tmobile": "@tmomail",
"verizon": "@vtext",
"sprint": "@messaging.sprintpcs"
}
EMAIL = "[email protected]"
PASSWORD = "paaa ssss word word"
recipient = phone_number + CARRIERS[carrier]
auth = (EMAIL, PASSWORD)
server = smtplib.SMTP("smtp.gmail", 587)
server.starttls()
server.login(auth[0], auth[1])
server.sendmail(auth[0], recipient, message)
本文标签: pythonTrouble Sending Text with smtplibStack Overflow
版权声明:本文标题:python - Trouble Sending Text with smtplib - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742384194a2464696.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论