From 8ebaa6676feca13b337be6f2d94d2d11a44b9840 Mon Sep 17 00:00:00 2001 From: Stefan Natter Date: Thu, 13 Jul 2017 09:36:36 +0200 Subject: [PATCH] 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 --- README.md | 9 ++++++--- src/Mailgun/Constants/ExceptionMessages.php | 2 +- src/Mailgun/Exception/HttpClientException.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d5bd5ed..a8832d6 100644 --- a/README.md +++ b/README.md @@ -60,14 +60,17 @@ Here's how to send a message using the SDK: $mg = Mailgun::create('key-example'); # Now, compose and send your message. +# $mg->messages()->send($domain, $params); $mg->messages()->send('example.com', [ - 'from' => 'bob@example.com', - 'to' => 'sally@example.com', - 'subject' => 'The PHP SDK is awesome!', + 'from' => 'bob@example.com', + 'to' => 'sally@example.com', + 'subject' => 'The PHP SDK is awesome!', '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 You find more detailed documentation at in [/doc](doc/index.md) and on diff --git a/src/Mailgun/Constants/ExceptionMessages.php b/src/Mailgun/Constants/ExceptionMessages.php index ab370aa..75f2aa4 100644 --- a/src/Mailgun/Constants/ExceptionMessages.php +++ b/src/Mailgun/Constants/ExceptionMessages.php @@ -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_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_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 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.'; diff --git a/src/Mailgun/Exception/HttpClientException.php b/src/Mailgun/Exception/HttpClientException.php index 140334b..1c65951 100644 --- a/src/Mailgun/Exception/HttpClientException.php +++ b/src/Mailgun/Exception/HttpClientException.php @@ -70,7 +70,7 @@ final class HttpClientException extends \RuntimeException implements Exception 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); } /**