gpt4 book ai didi

Mailgun 通过 HTTP API 发送似乎没有发送

转载 作者:行者123 更新时间:2023-12-05 00:26:39 26 4
gpt4 key购买 nike

我正在尝试使用 Mailgun to send via the HTTP API如下:

Python:

def send_simple_message(string):
return requests.post(
"https://api.mailgun.net/v2/samples.mailgun.org/messages",
auth=("api", "my-key"),
data={"from": "<me@mydomain.com",
"to": ["to@recipient.com"],
"subject": "",
"text": string})

我的域使用提供的 CNAME 记录进行验证,我尝试发送几个测试 string s。

从我的 Python 脚本中根本没有发生任何可见的事情 - 没有出现在已发送的项目 (gmail) 中。所以我通过终端手动尝试,并得到响应: <Response [404]> .

更新地址为 mydomain.com (感谢@kwatford)我收到 <Response [200]> (成功)。

但是,这是我发送给自己的测试电子邮件(在不同的地址)。我没有收到消息,也没有在 me@mydomain.com的发送框中任何一个。我做错了什么?

最佳答案

感谢@kwatford 发现了这个问题,对于被示例混淆的其他人,确切的解决方案如下:
https://api.mailgun.net/v2/samples.mailgun.org/messages应替换为:
https://api.mailgun.net/v2/yourdomain.com/messages .

我最初尝试的 [200]回复只是 http://mydomain.com这是 不正确 .

此外,我错误地期望它出现在已发送的项目中,尽管它确实出现在 cp > 登录 mailgun.com 中(现在我有正确的 POST 地址!)

关于Mailgun 通过 HTTP API 发送似乎没有发送,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21883689/

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