为什么此代码在发送邮件到mailgun邮件列表时发生错误?Mailgun无效参数
$mailgun->sendMessage(MAILGUN_DOMAIN,[
'from' => '[email protected]',
'to' => MAILGUN_LIST,
'subject' => $subject,
'html' => $body.'<br><br><a href="%unsubscribe_url%">Unsubscribe</a>'
]);
致命错误我得到低于给:
Fatal error: Uncaught 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. in C:\xampp\htdocs\webapp\vendor\mailgun\mailgun-php\src\Mailgun\Connection\RestClient.php:226 Stack trace: #0 C:\xampp\htdocs\webapp\vendor\mailgun\mailgun-php\src\Mailgun\Connection\RestClient.php(99): Mailgun\Connection\RestClient->responseHandler(Object(GuzzleHttp\Psr7\Response)) #1 C:\xampp\htdocs\webapp\vendor\mailgun\mailgun-php\src\Mailgun\Connection\RestClient.php(151): Mailgun\Connection\RestClient->send('POST', 'sandboxb676bd53...', Object(GuzzleHttp\Psr7\Stream), Array) #2 C:\xampp\htdocs\webapp\vendor\mailgun\mailgun-php\src\Mailgun\Mailgun.php(118): Mailgun\Connection\RestClient->post('sandboxb676bd53...', Array, Array) #3 C:\xampp\htdocs\webapp\vendor\mailgun\mailgun-php\src\Mailgun\Mailgun.php(61): Mailgun\Mailgun->post('sandbox in C:\xampp\htdocs\webapp\vendor\mailgun\mailgun-php\src\Mailgun\Connection\RestClient.php on line 226
我已将订阅列表中的邮件标识添加到授权收件人列表中,但仍会抛出相同的错误,我认为我们不需要在“发件人”地址中使用相同的域。 – user2531123
每当我试图从沙箱发送一封电子邮件到一个不同的域时,它就会失败。列表中的收件人是否也被设置为授权收件人?我不完全确定这是如何工作的。 – timkly
这是正确的答案。 – tfont