[英]can't send email to a mailgun's list with the API
I'm working on my own class that uses php to deliver all mailgun's operations through the API.我正在开发我自己的类,该类使用 php 通过 API 提供所有 mailgun 的操作。
I use my class to create a list + add 2 members with real emails.我用我的班级来创建一个列表 + 添加 2 个具有真实电子邮件的成员。 My control panel shows these items created.
我的控制面板显示了这些创建的项目。 When I send my message I inspect my logs from php + curl and I can see success but the message never reaches the list members!
当我发送消息时,我从 php + curl 检查我的日志,我可以看到成功,但消息永远不会到达列表成员!
On the other hand when a list member sends a mail to list then all list members receive it as I was expected cause I made the list open to members.另一方面,当列表成员向列表发送邮件时,所有列表成员都会按照我的预期收到它,因为我将列表向成员开放。
I inspect the logs at Mailgun's panel and I can see accepted.我检查了 Mailgun 面板上的日志,我可以看到已接受。
I suspected sth might be wrong in my domain record settings but Mailgun has verified my domain from godaddy.我怀疑我的域记录设置可能有误,但 Mailgun 已从 Godaddy 验证了我的域。
Another possibility might be that my account is flex and I should add a debit card that's why they deny to deliver my message.另一种可能性可能是我的帐户是灵活的,我应该添加一张借记卡,这就是他们拒绝传递我的消息的原因。
Anyway I tested in both the sandbox domain and a real one.无论如何,我在沙盒域和真实域中进行了测试。
My DNS records at godaddy implement the following:我在 Godaddy 的 DNS 记录实现了以下内容:
MX for domain.com because I forward mails to gmail
MX for mail.domain.com to make mailgun accept messages to my list
CNAME for both domains as proposed
A for both domains
TXT for both domains as proposed
Any idea what might be wrong?知道可能有什么问题吗?
I implemented a method that sends a request at API endpoint https://api.eu.mailgun.net/v3/DOMAIN/messages
where DOMAIN
is replaced from the sandbox or real domain.我实现了一种在 API 端点
https://api.eu.mailgun.net/v3/DOMAIN/messages
发送请求的方法,其中DOMAIN
从沙箱或真实域中替换。
I use this method for我用这个方法
1 recipient --> passes 1 个收件人 -->通过
a batch of recipients --> passes一批收件人 -->通过
a mail list --> fails邮件列表 -->失败
The documentation says nothing for different endpoints.对于不同的端点, 文档没有说明。
That's a strange API indeed!这确实是一个奇怪的 API!
your list has access level readonly
then you don't have to add this list in your recipients您的列表具有
readonly
访问级别,那么您不必将此列表添加到您的收件人中
your list has access level members
then ADD the list to the recipients列表中的访问级别
members
然后添加列表收件人
your list has access level everyone
then you don't have to add this list in your recipients.您的列表具有
everyone
访问级别,那么您不必将此列表添加到您的收件人中。
Now, send an authenticated message with the API - this is called administrator
at the docs(?)现在,使用 API 发送经过身份验证的消息 - 这在文档中称为
administrator
(?)
Case (2) seems logical as any address which is not a member can't - and shouldn't - send a message to the list even the API itself !情况 (2) 似乎合乎逻辑,因为任何不是成员的地址都不能 - 也不应该 - 向列表发送消息,甚至是 API 本身!
But wait, this is NOT the end of the story for case (2): when you send the message to the list you should define from
value that same list otherwise your message is accepted but never delivered!但是等等,这不是案例(2)的故事的结尾:当您将消息发送到列表时,您应该
from
值中定义同一个列表,否则您的消息将被接受但永远不会被传递!
Hopefully my code handles all the above cases automatically although I had to make a sendToList
method that calls eventually the generic send()
!希望我的代码能够自动处理上述所有情况,尽管我必须创建一个最终调用通用
send()
的sendToList
方法!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.