MailGun 参数无故无效

MailGun parameters are invalid for no apparent reason

我有一个非常简单的代码,它在我的 Symfony2 应用程序中使用了 MailGun:

public function sendNewEmail()
{
    $message = \Swift_Message::newInstance()
                    ->setSubject('Any random subject')
                    ->setFrom('welcome@mycompany.com')
                    ->setTo('myemail@email.com')
                    ->setBody('Mybody');
    $this->mailer->send($message);

    return null;
}

这段代码过去工作得很好,但几天前就不再工作了。它returns错误到底。

一旦我几乎没有更改代码中的任何内容,我就不知道这个问题会是什么。

我怎样才能发现是什么?

request.CRITICAL: Uncaught PHP Exception Mailgun\Connection\Exceptions\MissingRequiredParameters: "The parameters passed to the API were invalid. Check your inputs! Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in domain settings." at /srv/www/MyCodeSource/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php line 169 {"exception":"[object] (Mailgun\Connection\Exceptions\MissingRequiredParameters(code: 0): The parameters passed to the API were invalid. Check your inputs! Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in domain settings. at /srv/www/MyCodeSource/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php:169)"} []

是的,看来是我使用的沙盒域导致了问题。

我添加了一个自定义域并在我的 DNS 中添加了条目等...现在可以使用了

但最奇怪的是我用了好几个月了,从来没有遇到过这个问题。什么时候,也许是一个异常,最终被MailGun修复了。


更新 只是为了确认我上面所说的:我收到了 MailGun

的电子邮件

We've implemented changes that were announced and several notifications were sent out informing customers starting from November 1st. On December 1st, 2016...All domains, regardless of the creation date, will be required to verify the domain to continue sending and receiving messages.

这就是我的电子邮件突然停止的原因。在他们解释说我应该更改域、设置 DNS 配置等之后...

好吧,他们在我完成后发送了说明,但他们得到了很好、快速和明确的支持。只是给功劳...

这是此更改的官方通知:http://blog.mailgun.com/domain-verification-changes-for-new-and-existing-domains/