Mailgun invalid parameters

不想你离开。 提交于 2019-12-24 01:49:08

问题


Why this code is giving the error while sending email to mailgun mailing list ?

$mailgun->sendMessage(MAILGUN_DOMAIN,[

'from'          => 'test@samples.mailgun.org',
'to'            => MAILGUN_LIST,
'subject'       => $subject,
'html'          => $body.'<br><br><a href="%unsubscribe_url%">Unsubscribe</a>'

                    ]);

The fatal error i am getting is give below:

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


回答1:


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

If you are sending from the sandbox domain then you need to configure the allowed recipient list (max 5 users). See here for more details.

I'm also not sure it allows your to send to a mailing list either under the sandbox. Also, your from address should also have the same domain as the sandbox domain.




回答2:


Mailgun Email

                    $result = $mgClient->sendMessage($domain, array(
                    'from'    => ''.$txt_fname.' <'.$txt_femail.'>',
                    'to'      => ''.$email_address.'',
                    'subject' => ''.$txt_subject.'',
                    'text' =>''.$txt_only.'',
                    'html'    => '<html><body>'.$email_message.'</body></html>'
                ),$file_array);


来源:https://stackoverflow.com/questions/39140281/mailgun-invalid-parameters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!