Updated EXCEPTION_MISSING_ENDPOINT and README accordingly (#373)

* Updated EXCEPTION_MISSING_ENDPOINT and README accordingly

* Updated HttpClientException

* reuse existing ExceptionMessages constants

* removed ExceptionMessages constants again
This commit is contained in:
Stefan Natter 2017-07-13 09:36:36 +02:00 committed by Tobias Nyholm
parent ee35e40846
commit 8ebaa6676f
3 changed files with 8 additions and 5 deletions

View File

@ -60,14 +60,17 @@ Here's how to send a message using the SDK:
$mg = Mailgun::create('key-example'); $mg = Mailgun::create('key-example');
# Now, compose and send your message. # Now, compose and send your message.
# $mg->messages()->send($domain, $params);
$mg->messages()->send('example.com', [ $mg->messages()->send('example.com', [
'from' => 'bob@example.com', 'from' => 'bob@example.com',
'to' => 'sally@example.com', 'to' => 'sally@example.com',
'subject' => 'The PHP SDK is awesome!', 'subject' => 'The PHP SDK is awesome!',
'text' => 'It is so simple to send a message.' 'text' => 'It is so simple to send a message.'
]); ]);
``` ```
Attention: `$domain` must match to the domain you have configured on [app.mailgun.com](https://app.mailgun.com/app/domains).
### All usage examples ### All usage examples
You find more detailed documentation at in [/doc](doc/index.md) and on You find more detailed documentation at in [/doc](doc/index.md) and on

View File

@ -18,7 +18,7 @@ class ExceptionMessages
const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred! Check your network connection and try again.'; const EXCEPTION_GENERIC_HTTP_ERROR = 'An HTTP Error has occurred! Check your network connection and try again.';
const EXCEPTION_MISSING_REQUIRED_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!'; const EXCEPTION_MISSING_REQUIRED_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!';
const EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!'; const EXCEPTION_MISSING_REQUIRED_MIME_PARAMETERS = 'The parameters passed to the API were invalid. Check your inputs!';
const EXCEPTION_MISSING_ENDPOINT = "The endpoint you've tried to access does not exist. Check your URL."; const EXCEPTION_MISSING_ENDPOINT = "The endpoint you've tried to access does not exist. Check if the domain matches the domain you have configure on Mailgun.";
const TOO_MANY_RECIPIENTS = "You've exceeded the maximum recipient count (1,000) on the to field with autosend disabled."; const TOO_MANY_RECIPIENTS = "You've exceeded the maximum recipient count (1,000) on the to field with autosend disabled.";
const INVALID_PARAMETER_NON_ARRAY = "The parameter you've passed in position 2 must be an array."; const INVALID_PARAMETER_NON_ARRAY = "The parameter you've passed in position 2 must be an array.";
const INVALID_PARAMETER_ATTACHMENT = 'Attachments must be passed with an "@" preceding the file path. Web resources not supported.'; const INVALID_PARAMETER_ATTACHMENT = 'Attachments must be passed with an "@" preceding the file path. Web resources not supported.';

View File

@ -70,7 +70,7 @@ final class HttpClientException extends \RuntimeException implements Exception
public static function notFound(ResponseInterface $response = null) public static function notFound(ResponseInterface $response = null)
{ {
return new self('The endpoint you tried to access does not exist. Check your URL.', 404, $response); return new self('The endpoint you have tried to access does not exist. Check if the domain matches the domain you have configure on Mailgun.', 404, $response);
} }
/** /**