爲什麼此代碼在發送郵件到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