diff --git a/README.md b/README.md index 0174302..d088625 100644 --- a/README.md +++ b/README.md @@ -55,8 +55,8 @@ $mg = new Mailgun("key-example"); $domain = "example.com"; # Now, issue a GET against the Logs endpoint. -$mg->get('{$domain}/log', array('limit' => 'bob@example.com', - 'skip' => 'sally@example.com'); +$mg->get("$domain/log", array('limit' => 25, + 'skip' => 0); ``` For usage examples on each API endpoint, head over to our official documentation pages. diff --git a/src/Mailgun/Lists/OptInHandler.php b/src/Mailgun/Lists/OptInHandler.php index 6c5990a..fc538a1 100644 --- a/src/Mailgun/Lists/OptInHandler.php +++ b/src/Mailgun/Lists/OptInHandler.php @@ -27,7 +27,7 @@ class OptInHandler{ $concatStrings = $secretAppId . "" . $urlParameters->r; if($urlParameters->s == hash('md5', $concatStrings)){ - $returnArray = array('recipientAddress' => $urlParameters->r, 'mailingList' => $mailingList); + $returnArray = array('recipientAddress' => $urlParameters->r, 'mailingList' => $urlParameters->l); return $returnArray; } return false; diff --git a/src/Mailgun/Lists/README.md b/src/Mailgun/Lists/README.md index d6d9872..2035509 100644 --- a/src/Mailgun/Lists/README.md +++ b/src/Mailgun/Lists/README.md @@ -9,9 +9,9 @@ There is currently one utility provided. OptInHandler: Provides methods for authenticating an OptInRequest. -The typical flow for using this utility would be as follow: -(Recipient Requests Subscribe) -> [Generate Opt In Link] -> [Email Recipient Opt In Link] -(Recipient Clicks Opt In Link) -> [Validate Opt In Link] -> [Subscribe User] -> [Send final confirmation] +The typical flow for using this utility would be as follows: +**Recipient Requests Subscribe** -> [Validate Recipient Address] -> [Generate Opt In Link] -> [Email Recipient Opt In Link] +**Recipient Clicks Opt In Link** -> [Validate Opt In Link] -> [Subscribe User] -> [Send final confirmation] The above flow is modeled below. @@ -20,32 +20,39 @@ Usage - Opt-In Handler (Recipient Requests Subscribe) Here's how to use Opt-In Handler to validate Opt-In requests. ```php -# First, instantiate the SDK with your API credentials and domain. -$mg = new Mailgun("key-example"); -$domain = "example.com"; +# First, instantiate the SDK with your API credentials, domain, and required parameters for example. +$mg = new Mailgun('key-example'); +$mgValidate = new Mailgun('pub-key-example'); -# Next, instantiate an OptInHandler object from the SDK. -$optInHandler = $mg->OptInHandler(); - -# Next, define necessary variables and generate a hash. +$domain = 'example.com'; $mailingList = 'youlist@example.com'; $secretPassphrase = 'a_secret_passphrase'; -$recipientAddress = 'recipient@example.com' -$generatedHash = $optInHandler->generateHash($mailingList, $secretPassphrase, $recipientAddress); +$recipientAddress = 'recipient@example.com'; -# Now, let's send a confirmation to the recipient with our link. -$mg->sendMessage($domain, array('from' => 'bob@example.com', - 'to' => 'sally@example.com', - 'subject' => 'Please Confirm!', - 'html' => '
Hello,