-1
나는 유료 메일 링 계정을 새로 만들었으며 도메인은 모두 설정 및 확인되었습니다. 내 키와 도메인 자신의 샘플 코드를 사용 :Mailgun을 사용하여 보내기 : HttpClientException mailgun-php 라이브러리가있는 샘플 코드 사용
$mg = Mailgun::create('key-XXXXX');
$mg->messages()->send('mailgun.MYDOMAIN.com', [
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => 'The PHP SDK is awesome',
'text' => 'It is so simple to send a message'
]);
나는별로 ...
Fatal error: Uncaught exception 'Mailgun\Exception\HttpClientException' with message 'The parameters passed to the API were invalid. Check your inputs!' in /home/MYDOMAIN/public_html/include/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HttpClientException.php:59
Stack trace:
#0 /home/MYDOMAIN/public_html/include/vendor/mailgun/mailgun-php/src/Mailgun/Api/HttpApi.php(91): Mailgun\Exception\HttpClientException::badRequest(Object(GuzzleHttp\Psr7\Response))
#1 /home/MYDOMAIN/public_html/include/vendor/mailgun/mailgun-php/src/Mailgun/Api/HttpApi.php(73): Mailgun\Api\HttpApi->handleErrors(Object(GuzzleHttp\Psr7\Response))
#2 /home/MYDOMAIN/public_html/include/vendor/mailgun/mailgun-php/src/Mailgun/Api/Message.php(52): Mailgun\Api\HttpApi->hydrateResponse(Object(GuzzleHttp\Psr7\Response), 'Mailgun\\Model\\M...')
#3 /home/MYDOMAIN/public_html/test.php(40): Mailgun\Api\Message->send('mailgun.MYDOMAIN...', Array)
#4 {main}
thrown in /home/MYDOMAIN/public_html/include/vendor/mailgun/mailgun-php/src/Mailgun/Exception/HttpClientException.php on line 59
응답 객체의 var_dump()
저를주는 오류 출력을 얻을 :
object(GuzzleHttp\Psr7\Response)#32 (6) {
["reasonPhrase":"GuzzleHttp\Psr7\Response":private]=>
string(11) "BAD REQUEST"
["statusCode":"GuzzleHttp\Psr7\Response":private]=>
int(400)
["headers":"GuzzleHttp\Psr7\Response":private]=>
array(5) {
["Content-Type"]=>
array(1) {
[0]=>
string(16) "application/json"
}
["Date"]=>
array(1) {
[0]=>
string(29) "Sat, 16 Dec 2017 21:06:26 GMT"
}
["Server"]=>
array(1) {
[0]=>
string(5) "nginx"
}
["Content-Length"]=>
array(1) {
[0]=>
string(3) "137"
}
["Connection"]=>
array(1) {
[0]=>
string(10) "keep-alive"
}
}
["headerNames":"GuzzleHttp\Psr7\Response":private]=>
array(5) {
["content-type"]=>
string(12) "Content-Type"
["date"]=>
string(4) "Date"
["server"]=>
string(6) "Server"
["content-length"]=>
string(14) "Content-Length"
["connection"]=>
string(10) "Connection"
}
["protocol":"GuzzleHttp\Psr7\Response":private]=>
string(3) "1.1"
["stream":"GuzzleHttp\Psr7\Response":private]=>
object(GuzzleHttp\Psr7\Stream)#31 (7) {
["stream":"GuzzleHttp\Psr7\Stream":private]=>
resource(83) of type (stream)
["size":"GuzzleHttp\Psr7\Stream":private]=>
NULL
["seekable":"GuzzleHttp\Psr7\Stream":private]=>
bool(true)
["readable":"GuzzleHttp\Psr7\Stream":private]=>
bool(true)
["writable":"GuzzleHttp\Psr7\Stream":private]=>
bool(true)
["uri":"GuzzleHttp\Psr7\Stream":private]=>
string(10) "php://temp"
["customMetadata":"GuzzleHttp\Psr7\Stream":private]=>
array(0) {
}
}
}
github에 게시 된 디버그 솔루션을 사용해 보았습니다.
$configurator = new Mailgun\HttpClientConfigurator();
$configurator->setEndpoint('http://bin.mailgun.net/f1e56c6a');
$configurator->setDebug(true);
$mg = Mailgun\Mailgun::configure($configurator);
# Now, compose and send your message.
$mg->messages()->send('example.com', [
'from' => '[email protected]',
'to' => '[email protected]',
'subject' => 'The PHP SDK is awesome!',
'text' => 'It is so simple to send a message.'
]);
내가 PHP의 v5.6.32을 사용하고
Fatal error: Uncaught exception 'Mailgun\Exception\HydrationException' with message 'The ModelHydrator cannot hydrate response with Content-Type: text/html;charset=utf-8' in /home/MYDOMAIN/public_html/include/vendor/mailgun/mailgun-php/src/Mailgun/Hydrator/ModelHydrator.php:34
: 만 나에게 또 다른 쓸모없는 오류 응답을 제공
. 이 오류를 해결하기 위해 수집 할 수있는 정보가 없습니다. 누구나이 아이디어를 가지고 경험 한 적이 있습니까?