Hi, I am using mailgun php sdk for sending mail with active domains of mailgun. Below is my php code for sending mail.
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
try {
$mg = Mailgun::create('[My Key]');
$htmlMessage = '';
print_r(
$mg->messages()->send('[My Activated Domain]', [
'from' => 'zakirali1991@gmail.com',
'to' => 'hussainzakirali@gmail.com',
'subject' => 'The PHP SDK is awesome!',
'text' => 'It is so simple to send a message.'
]
)
);
} catch (Exception $ex) {
print_r($ex->getTrace());
//print_r($mg);
}
The above code working fine when sending mail to "zakir@phonato.com" but when i am trying to send mail to "hussainzakirali@gmail.com, zakirali1991@gmail.com, zakir1991@yahoo.com"
i am getting the error of "The parameters passed to the API were invalid. Check your inputs!"
Hi, I am using mailgun php sdk for sending mail with active domains of mailgun. Below is my php code for sending mail.
The above code working fine when sending mail to "zakir@phonato.com" but when i am trying to send mail to "hussainzakirali@gmail.com, zakirali1991@gmail.com, zakir1991@yahoo.com" i am getting the error of "The parameters passed to the API were invalid. Check your inputs!"
Stack Trace - Array ( [0] => Array ( [file] => /Library/WebServer/Documents/testMailGunEmail/vendor/mailgun/mailgun-php/src/Mailgun/Api/HttpApi.php [line] => 91 [function] => badRequest [class] => Mailgun\Exception\HttpClientException [type] => :: [args] => Array ( [0] => GuzzleHttp\Psr7\Response Object ( [reasonPhrase:GuzzleHttp\Psr7\Response:private] => BAD REQUEST [statusCode:GuzzleHttp\Psr7\Response:private] => 400 [headers:GuzzleHttp\Psr7\Response:private] => Array ( [Content-Type] => Array ( [0] => application/json ) [Date] => Array ( [0] => Thu, 03 Aug 2017 14:37:04 GMT ) [Server] => Array ( [0] => nginx ) [Content-Length] => Array ( [0] => 140 ) [Connection] => Array ( [0] => keep-alive ) ) [headerNames:GuzzleHttp\Psr7\Response:private] => Array ( [content-type] => Content-Type [date] => Date [server] => Server [content-length] => Content-Length [connection] => Connection ) [protocol:GuzzleHttp\Psr7\Response:private] => 1.1 [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object ( [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #91 [size:GuzzleHttp\Psr7\Stream:private] => [seekable:GuzzleHttp\Psr7\Stream:private] => 1 [readable:GuzzleHttp\Psr7\Stream:private] => 1 [writable:GuzzleHttp\Psr7\Stream:private] => 1 [uri:GuzzleHttp\Psr7\Stream:private] => php://temp [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array ( ) ) ) ) ) [1] => Array ( [file] => /Library/WebServer/Documents/testMailGunEmail/vendor/mailgun/mailgun-php/src/Mailgun/Api/HttpApi.php [line] => 73 [function] => handleErrors [class] => Mailgun\Api\HttpApi [type] => -> [args] => Array ( [0] => GuzzleHttp\Psr7\Response Object ( [reasonPhrase:GuzzleHttp\Psr7\Response:private] => BAD REQUEST [statusCode:GuzzleHttp\Psr7\Response:private] => 400 [headers:GuzzleHttp\Psr7\Response:private] => Array ( [Content-Type] => Array ( [0] => application/json ) [Date] => Array ( [0] => Thu, 03 Aug 2017 14:37:04 GMT ) [Server] => Array ( [0] => nginx ) [Content-Length] => Array ( [0] => 140 ) [Connection] => Array ( [0] => keep-alive ) ) [headerNames:GuzzleHttp\Psr7\Response:private] => Array ( [content-type] => Content-Type [date] => Date [server] => Server [content-length] => Content-Length [connection] => Connection ) [protocol:GuzzleHttp\Psr7\Response:private] => 1.1 [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object ( [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #91 [size:GuzzleHttp\Psr7\Stream:private] => [seekable:GuzzleHttp\Psr7\Stream:private] => 1 [readable:GuzzleHttp\Psr7\Stream:private] => 1 [writable:GuzzleHttp\Psr7\Stream:private] => 1 [uri:GuzzleHttp\Psr7\Stream:private] => php://temp [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array ( ) ) ) ) ) [2] => Array ( [file] => /Library/WebServer/Documents/testMailGunEmail/vendor/mailgun/mailgun-php/src/Mailgun/Api/Message.php [line] => 52 [function] => hydrateResponse [class] => Mailgun\Api\HttpApi [type] => -> [args] => Array ( [0] => GuzzleHttp\Psr7\Response Object ( [reasonPhrase:GuzzleHttp\Psr7\Response:private] => BAD REQUEST [statusCode:GuzzleHttp\Psr7\Response:private] => 400 [headers:GuzzleHttp\Psr7\Response:private] => Array ( [Content-Type] => Array ( [0] => application/json ) [Date] => Array ( [0] => Thu, 03 Aug 2017 14:37:04 GMT ) [Server] => Array ( [0] => nginx ) [Content-Length] => Array ( [0] => 140 ) [Connection] => Array ( [0] => keep-alive ) ) [headerNames:GuzzleHttp\Psr7\Response:private] => Array ( [content-type] => Content-Type [date] => Date [server] => Server [content-length] => Content-Length [connection] => Connection ) [protocol:GuzzleHttp\Psr7\Response:private] => 1.1 [stream:GuzzleHttp\Psr7\Response:private] => GuzzleHttp\Psr7\Stream Object ( [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #91 [size:GuzzleHttp\Psr7\Stream:private] => [seekable:GuzzleHttp\Psr7\Stream:private] => 1 [readable:GuzzleHttp\Psr7\Stream:private] => 1 [writable:GuzzleHttp\Psr7\Stream:private] => 1 [uri:GuzzleHttp\Psr7\Stream:private] => php://temp [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array ( ) ) ) [1] => Mailgun\Model\Message\SendResponse ) ) [3] => Array ( [file] => /Library/WebServer/Documents/testMailGunEmail/index.php [line] => 27 [function] => send [class] => Mailgun\Api\Message [type] => -> [args] => Array ( [0] => mailers.7starslots.com [1] => Array ( [from] => zakir@phonato.com [to] => zakirali1991@gmail.com [subject] => The PHP SDK is awesome! [text] => It is so simple to send a message. ) ) ) )
Please help me where is the problem. My mailgun account and domain is active.