gpt4 book ai didi

python - 通过 Python 和 smtplib 发送 Verizon SMS 消息

转载 作者:太空宇宙 更新时间:2023-11-03 14:32:07 25 4
gpt4 key购买 nike

我可以让 smtplib 发送到其他电子邮件地址,但由于某种原因它没有发送到我的手机。

import smtplib
msg = 'test'
server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login("<username>","<password>")
server.sendmail(username, "<number>@vtext.com", msg)
server.quit()

本地址是gmail账户时,消息发送成功,使用原生gmail接口(interface)向手机发送消息完美无缺。 SMS 消息号码有什么不同?

注意:使用 set_debuglevel() 我可以看出 smtplib 认为消息是成功的,所以我相当有信心这种差异与 vtext 数字的行为有关。

最佳答案

电子邮件被拒绝,因为它看起来不像电子邮件(没有任何“发件人”或“主题”字段)

这个有效:

import smtplib

username = "account@gmail.com"
password = "password"

vtext = "1112223333@vtext.com"
message = "this is the message to be sent"

msg = """From: %s
To: %s
Subject: text-message
%s""" % (username, vtext, message)

server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls()
server.login(username,password)
server.sendmail(username, vtext, msg)
server.quit()

关于python - 通过 Python 和 smtplib 发送 Verizon SMS 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8982572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com