├── .circleci └── config.yml ├── .gitignore ├── .php-cs-fixer.dist.php ├── LICENSE ├── README.md ├── composer.json ├── phpstan.neon ├── phpunit.xml.dist ├── src └── Postmark │ ├── Models │ ├── CaseInsensitiveArray.php │ ├── DataRemovalRequestResponse.php │ ├── DynamicResponseModel.php │ ├── MessageStream │ │ ├── PostmarkMessageStream.php │ │ ├── PostmarkMessageStreamArchivalConfirmation.php │ │ └── PostmarkMessageStreamList.php │ ├── PostmarkAddressFull.php │ ├── PostmarkAgentInfo.php │ ├── PostmarkAttachment.php │ ├── PostmarkBounce.php │ ├── PostmarkBounceActivation.php │ ├── PostmarkBounceDump.php │ ├── PostmarkBounceList.php │ ├── PostmarkBounceSummary.php │ ├── PostmarkClick.php │ ├── PostmarkClickList.php │ ├── PostmarkDeliveryStats.php │ ├── PostmarkDomain.php │ ├── PostmarkDomainDetails.php │ ├── PostmarkDomainList.php │ ├── PostmarkException.php │ ├── PostmarkGeographyInfo.php │ ├── PostmarkInboundMessage.php │ ├── PostmarkInboundMessageList.php │ ├── PostmarkInboundRuleTrigger.php │ ├── PostmarkInboundRuleTriggerList.php │ ├── PostmarkMessage.php │ ├── PostmarkMessageBase.php │ ├── PostmarkMessageDump.php │ ├── PostmarkMessageEvent.php │ ├── PostmarkMessageEventDetails.php │ ├── PostmarkMessageEvents.php │ ├── PostmarkOpen.php │ ├── PostmarkOpenList.php │ ├── PostmarkOutboundMessage.php │ ├── PostmarkOutboundMessageDetail.php │ ├── PostmarkOutboundMessageList.php │ ├── PostmarkResponse.php │ ├── PostmarkSenderSignature.php │ ├── PostmarkSenderSignatureList.php │ ├── PostmarkServer.php │ ├── PostmarkServerList.php │ ├── PostmarkTemplate.php │ ├── PostmarkTemplateList.php │ ├── Stats │ │ ├── PostmarkOutboundBounceStats.php │ │ ├── PostmarkOutboundClickStats.php │ │ ├── PostmarkOutboundLocationStats.php │ │ ├── PostmarkOutboundOpenStats.php │ │ ├── PostmarkOutboundOverviewStats.php │ │ ├── PostmarkOutboundPlatformStats.php │ │ ├── PostmarkOutboundReadStats.php │ │ ├── PostmarkOutboundSentStats.php │ │ ├── PostmarkOutboundSpamComplaintStats.php │ │ └── PostmarkOutboundTrackedStats.php │ ├── Suppressions │ │ ├── PostmarkSuppression.php │ │ ├── PostmarkSuppressionList.php │ │ ├── PostmarkSuppressionRequestResult.php │ │ ├── PostmarkSuppressionResultList.php │ │ └── SuppressionChangeRequest.php │ ├── TemplateValidationResponse.php │ ├── TemplatedPostmarkMessage.php │ └── Webhooks │ │ ├── HttpAuth.php │ │ ├── HttpHeader.php │ │ ├── WebhookConfiguration.php │ │ ├── WebhookConfigurationBounceTrigger.php │ │ ├── WebhookConfigurationClickTrigger.php │ │ ├── WebhookConfigurationDeliveryTrigger.php │ │ ├── WebhookConfigurationListingResponse.php │ │ ├── WebhookConfigurationOpenTrigger.php │ │ ├── WebhookConfigurationSpamComplaintTrigger.php │ │ ├── WebhookConfigurationSubscriptionChangeTrigger.php │ │ └── WebhookConfigurationTriggers.php │ ├── PostmarkAdminClient.php │ ├── PostmarkClient.php │ └── PostmarkClientBase.php ├── testing_keys.json.example └── tests ├── PostmarkAdminClientDataRemovalTest.php ├── PostmarkAdminClientDomainTest.php ├── PostmarkAdminClientSenderSignatureTest.php ├── PostmarkAdminClientServersTest.php ├── PostmarkClickClientStatisticsTest.php ├── PostmarkClientBaseTest.php ├── PostmarkClientBounceTest.php ├── PostmarkClientEmailTest.php ├── PostmarkClientEmailsAsStringOrArrayTest.php ├── PostmarkClientInboundMessageTest.php ├── PostmarkClientMessageStreamsTest.php ├── PostmarkClientOutboundMessageTest.php ├── PostmarkClientRuleTriggerTest.php ├── PostmarkClientServerTest.php ├── PostmarkClientStatisticsTest.php ├── PostmarkClientSuppressionsTest.php ├── PostmarkClientTemplatesTest.php ├── PostmarkClientWebhooksTest.php ├── TestingKeys.php └── postmark-logo.png /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # In order for builds to pass, in CircleCI you must add all required environment variables, described in `testing_keys.json.example` 2 | 3 | version: 2.1 4 | 5 | workflows: 6 | php-tests: 7 | jobs: 8 | - unit-tests: 9 | name: php81 10 | version: "8.1" 11 | - unit-tests: 12 | name: php82 13 | version: "8.2" 14 | requires: 15 | - php81 16 | - unit-tests: 17 | name: php83 18 | version: "8.3" 19 | requires: 20 | - php82 21 | 22 | jobs: 23 | unit-tests: 24 | parameters: 25 | version: 26 | description: "PHP version tag" 27 | type: string 28 | 29 | docker: 30 | - image: cimg/php:<< parameters.version >> 31 | 32 | steps: 33 | - checkout 34 | - run: 35 | name: Version 36 | command: | 37 | echo "PHP: $(php --version)" 38 | - run: 39 | name: Install dependencies 40 | command: | 41 | sudo composer self-update 42 | sudo composer install --no-interaction 43 | - run: 44 | name: Run tests 45 | command: composer test 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | oracle.sqlite 3 | .phpintel 4 | test_keys.json 5 | testing_keys.json 6 | /vendor 7 | /build 8 | docs/_build 9 | *.swp 10 | /composer.lock 11 | .idea 12 | .phpunit.cache/ 13 | .phpunit.result.cache 14 | -------------------------------------------------------------------------------- /.php-cs-fixer.dist.php: -------------------------------------------------------------------------------- 1 | ` 10 | * 11 | * @see https://activecampaign.atlassian.net/wiki/spaces/DEV/pages/24051783/ActiveCampaign+PHP+Coding+Style+Standards 12 | * @see https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst 13 | */ 14 | $finder = PhpCsFixer\Finder::create()->in(__DIR__); 15 | $config = new PhpCsFixer\Config(); 16 | 17 | return $config->setRules([ 18 | '@PhpCsFixer' => true, 19 | '@PHP82Migration' => true, 20 | 'concat_space' => ['spacing' => 'one'], // This is required by [PER coding style rule 6.2 binary operators](https://www.php-fig.org/per/coding-style/#62-binary-operators) 21 | 'global_namespace_import' => [ 22 | 'import_classes' => true, 23 | 'import_constants' => false, 24 | 'import_functions' => false, 25 | ], 26 | ]); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 ActiveCampaign 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Postmark-PHP 2 | 3 | **Postmark-PHP** is the _officially supported_ PHP library for [Postmark](http://postmarkapp.com). 4 | 5 | With Postmark, you can send and _receive_ emails effortlessly. 6 | 7 | [Check out our wiki](https://github.com/ActiveCampaign/postmark-php/wiki/Getting-Started) to get started using Postmark-PHP now. 8 | 9 | [![Build Status](https://circleci.com/gh/ActiveCampaign/postmark-php.svg?style=shield)](https://circleci.com/gh/ActiveCampaign/postmark-php) 10 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "repositories": [ 3 | { 4 | "type": "composer", 5 | "url": "https://packagist.org" 6 | } 7 | ], 8 | "name": "wildbit/postmark-php", 9 | "license": "MIT", 10 | "description": "The officially supported client for Postmark (http://postmarkapp.com)", 11 | "require": { 12 | "php": "~8.1 || ~8.2|| ~8.3", 13 | "guzzlehttp/guzzle": "^7.8" 14 | }, 15 | "require-dev": { 16 | "phpunit/phpunit": "^9", 17 | "phpstan/phpstan": "^1.10", 18 | "friendsofphp/php-cs-fixer": "^3.40" 19 | }, 20 | "autoload": { 21 | "psr-0": { 22 | "Postmark\\": "src/" 23 | } 24 | }, 25 | "autoload-dev": { 26 | "classmap": [ 27 | "src/", 28 | "tests/" 29 | ] 30 | }, 31 | "scripts": { 32 | "test": "phpunit" 33 | }, 34 | "config": { 35 | "allow-plugins": { 36 | "dealerdirect/phpcodesniffer-composer-installer": true, 37 | "php-http/discovery": false 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 5 3 | paths: 4 | - src 5 | - tests 6 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | tests/ 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/Postmark/Models/CaseInsensitiveArray.php: -------------------------------------------------------------------------------- 1 | _container = array_change_key_case($initialArray); 30 | } 31 | 32 | #[ReturnTypeWillChange] 33 | public function offsetSet($offset, $value) 34 | { 35 | if (is_string($offset)) { 36 | $offset = $this->fixOffsetName($offset); 37 | } 38 | 39 | if (is_null($offset)) { 40 | $this->_container[] = $value; 41 | } else { 42 | $this->_container[$offset] = $value; 43 | } 44 | } 45 | 46 | #[ReturnTypeWillChange] 47 | public function offsetExists($offset) 48 | { 49 | if (is_string($offset)) { 50 | $offset = $this->fixOffsetName($offset); 51 | } 52 | 53 | return isset($this->_container[$offset]); 54 | } 55 | 56 | #[ReturnTypeWillChange] 57 | public function offsetUnset($offset) 58 | { 59 | if (is_string($offset)) { 60 | $offset = $this->fixOffsetName($offset); 61 | } 62 | 63 | unset($this->_container[$offset]); 64 | } 65 | 66 | #[ReturnTypeWillChange] 67 | public function offsetGet($offset) 68 | { 69 | if (is_string($offset)) { 70 | $offset = $this->fixOffsetName($offset); 71 | } 72 | 73 | return $this->_container[$offset] ?? null; 74 | } 75 | 76 | #[ReturnTypeWillChange] 77 | public function current() 78 | { 79 | // use "offsetGet" instead of indexes 80 | // so that subclasses can override behavior if needed. 81 | return $this->offsetGet($this->key()); 82 | } 83 | 84 | #[ReturnTypeWillChange] 85 | public function key() 86 | { 87 | $keys = array_keys($this->_container); 88 | 89 | return $keys[$this->_pointer]; 90 | } 91 | 92 | #[ReturnTypeWillChange] 93 | public function next() 94 | { 95 | ++$this->_pointer; 96 | } 97 | 98 | #[ReturnTypeWillChange] 99 | public function rewind() 100 | { 101 | $this->_pointer = 0; 102 | } 103 | 104 | #[ReturnTypeWillChange] 105 | public function valid() 106 | { 107 | return count(array_keys($this->_container)) > $this->_pointer; 108 | } 109 | 110 | private function fixOffsetName($offset) 111 | { 112 | return preg_replace('/_/', '', strtolower($offset)); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/Postmark/Models/DataRemovalRequestResponse.php: -------------------------------------------------------------------------------- 1 | ID = !empty($values['ID']) ? $values['ID'] : 0; 13 | $this->Status = !empty($values['Status']) ? $values['Status'] : ''; 14 | } 15 | 16 | public function getID(): int 17 | { 18 | return $this->ID; 19 | } 20 | 21 | public function setID(int $ID): DataRemovalRequestResponse 22 | { 23 | $this->ID = $ID; 24 | 25 | return $this; 26 | } 27 | 28 | public function getStatus(): string 29 | { 30 | return $this->Status; 31 | } 32 | 33 | public function setStatus(string $Status): DataRemovalRequestResponse 34 | { 35 | $this->Status = $Status; 36 | 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Postmark/Models/DynamicResponseModel.php: -------------------------------------------------------------------------------- 1 | getServer(); 19 | * 20 | * //You have many ways of accessing the same members: 21 | * $server->id; 22 | * $server->Id; 23 | * $server["id"]; 24 | * $server["ID"]; 25 | * ``` 26 | */ 27 | class DynamicResponseModel extends CaseInsensitiveArray 28 | { 29 | /** 30 | * Create a new DynamicResponseModel from an associative array. 31 | * 32 | * @param array $data the source associative array 33 | */ 34 | public function __construct(array $data) 35 | { 36 | parent::__construct($data); 37 | } 38 | 39 | /** 40 | * Infrastructure. Get an element by name. 41 | * 42 | * @param mixed $name name of element to get from the dynamic response model 43 | */ 44 | public function __get($name) 45 | { 46 | $value = $this[$name]; 47 | 48 | // If there's a value and it's an array, 49 | // convert it to a dynamic response object, too. 50 | if (null != $value && is_array($value)) { 51 | $value = new DynamicResponseModel($value); 52 | } 53 | 54 | return $value; 55 | } 56 | 57 | /** 58 | * Infrastructure. Allows indexer to return a DynamicResponseModel. 59 | */ 60 | #[ReturnTypeWillChange] 61 | public function offsetGet($offset) 62 | { 63 | $result = parent::offsetGet($offset); 64 | if (null != $result && is_array($result)) { 65 | $result = new DynamicResponseModel($result); 66 | } 67 | 68 | return $result; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Postmark/Models/MessageStream/PostmarkMessageStream.php: -------------------------------------------------------------------------------- 1 | ID = !empty($values['ID']) ? $values['ID'] : ''; 19 | $this->ServerID = !empty($values['ServerID']) ? $values['ServerID'] : 0; 20 | $this->Name = !empty($values['Name']) ? $values['Name'] : ''; 21 | $this->Description = !empty($values['Description']) ? $values['Description'] : ''; 22 | $this->MessageStreamType = !empty($values['MessageStreamType']) ? $values['MessageStreamType'] : ''; 23 | $this->CreatedAt = !empty($values['CreatedAt']) ? $values['CreatedAt'] : ''; 24 | $this->UpdatedAt = !empty($values['UpdatedAt']) ? $values['UpdatedAt'] : null; 25 | $this->ArchivedAt = !empty($values['ArchivedAt']) ? $values['ArchivedAt'] : null; 26 | } 27 | 28 | public function getID(): string 29 | { 30 | return $this->ID; 31 | } 32 | 33 | public function setID(string $ID): PostmarkMessageStream 34 | { 35 | $this->ID = $ID; 36 | 37 | return $this; 38 | } 39 | 40 | public function getServerID(): int 41 | { 42 | return $this->ServerID; 43 | } 44 | 45 | public function setServerID(int $ServerID): PostmarkMessageStream 46 | { 47 | $this->ServerID = $ServerID; 48 | 49 | return $this; 50 | } 51 | 52 | public function getName(): string 53 | { 54 | return $this->Name; 55 | } 56 | 57 | public function setName(string $Name): PostmarkMessageStream 58 | { 59 | $this->Name = $Name; 60 | 61 | return $this; 62 | } 63 | 64 | public function getDescription(): string 65 | { 66 | return $this->Description; 67 | } 68 | 69 | public function setDescription(string $Description): PostmarkMessageStream 70 | { 71 | $this->Description = $Description; 72 | 73 | return $this; 74 | } 75 | 76 | public function getMessageStreamType(): string 77 | { 78 | return $this->MessageStreamType; 79 | } 80 | 81 | public function setMessageStreamType(string $MessageStreamType): PostmarkMessageStream 82 | { 83 | $this->MessageStreamType = $MessageStreamType; 84 | 85 | return $this; 86 | } 87 | 88 | public function getCreatedAt(): string 89 | { 90 | return $this->CreatedAt; 91 | } 92 | 93 | public function setCreatedAt(string $CreatedAt): PostmarkMessageStream 94 | { 95 | $this->CreatedAt = $CreatedAt; 96 | 97 | return $this; 98 | } 99 | 100 | public function getUpdatedAt(): ?string 101 | { 102 | return $this->UpdatedAt; 103 | } 104 | 105 | public function setUpdatedAt(?string $UpdatedAt): PostmarkMessageStream 106 | { 107 | $this->UpdatedAt = $UpdatedAt; 108 | 109 | return $this; 110 | } 111 | 112 | public function getArchivedAt(): ?string 113 | { 114 | return $this->ArchivedAt; 115 | } 116 | 117 | public function setArchivedAt(?string $ArchivedAt): PostmarkMessageStream 118 | { 119 | $this->ArchivedAt = $ArchivedAt; 120 | 121 | return $this; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/Postmark/Models/MessageStream/PostmarkMessageStreamArchivalConfirmation.php: -------------------------------------------------------------------------------- 1 | ID = !empty($values['ID']) ? $values['ID'] : ''; 14 | $this->ServerID = !empty($values['ServerID']) ? $values['ServerID'] : 0; 15 | $this->ExpectedPurgeDate = !empty($values['ExpectedPurgeDate']) ? $values['ExpectedPurgeDate'] : ''; 16 | } 17 | 18 | public function getID(): string 19 | { 20 | return $this->ID; 21 | } 22 | 23 | public function setID(string $ID): PostmarkMessageStreamArchivalConfirmation 24 | { 25 | $this->ID = $ID; 26 | 27 | return $this; 28 | } 29 | 30 | public function getServerID(): int 31 | { 32 | return $this->ServerID; 33 | } 34 | 35 | public function setServerID(int $ServerID): PostmarkMessageStreamArchivalConfirmation 36 | { 37 | $this->ServerID = $ServerID; 38 | 39 | return $this; 40 | } 41 | 42 | public function getExpectedPurgeDate(): string 43 | { 44 | return $this->ExpectedPurgeDate; 45 | } 46 | 47 | public function setExpectedPurgeDate(string $ExpectedPurgeDate): PostmarkMessageStreamArchivalConfirmation 48 | { 49 | $this->ExpectedPurgeDate = $ExpectedPurgeDate; 50 | 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Postmark/Models/MessageStream/PostmarkMessageStreamList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempMessageStreams = []; 14 | foreach ($values['MessageStreams'] as $open) { 15 | $obj = json_decode(json_encode($open)); 16 | $postmarkMessageStreams = new PostmarkMessageStream((array) $obj); 17 | 18 | $tempMessageStreams[] = $postmarkMessageStreams; 19 | } 20 | $this->MessageStreams = $tempMessageStreams; 21 | } 22 | 23 | /** 24 | * @return int 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | public function setTotalCount(int $TotalCount): PostmarkMessageStreamList 32 | { 33 | $this->TotalCount = $TotalCount; 34 | 35 | return $this; 36 | } 37 | 38 | public function getMessageStreams(): array 39 | { 40 | return $this->MessageStreams; 41 | } 42 | 43 | public function setMessageStreams(array $MessageStreams): PostmarkMessageStreamList 44 | { 45 | $this->MessageStreams = $MessageStreams; 46 | 47 | return $this; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkAddressFull.php: -------------------------------------------------------------------------------- 1 | Email = !empty($values['Email']) ? $values['Email'] : ''; 14 | $this->Name = !empty($values['Name']) ? $values['Name'] : ''; 15 | $this->MailboxHash = !empty($values['MailboxHash']) ? $values['MailboxHash'] : ''; 16 | } 17 | 18 | /** 19 | * @return mixed|string 20 | */ 21 | public function getEmail(): mixed 22 | { 23 | return $this->Email; 24 | } 25 | 26 | /** 27 | * @param mixed|string $Email 28 | */ 29 | public function setEmail(mixed $Email): PostmarkAddressFull 30 | { 31 | $this->Email = $Email; 32 | 33 | return $this; 34 | } 35 | 36 | /** 37 | * @return mixed|string 38 | */ 39 | public function getName(): mixed 40 | { 41 | return $this->Name; 42 | } 43 | 44 | /** 45 | * @param mixed|string $Name 46 | */ 47 | public function setName(mixed $Name): PostmarkAddressFull 48 | { 49 | $this->Name = $Name; 50 | 51 | return $this; 52 | } 53 | 54 | /** 55 | * @return mixed|string 56 | */ 57 | public function getMailboxHash(): mixed 58 | { 59 | return $this->MailboxHash; 60 | } 61 | 62 | /** 63 | * @param mixed|string $MailboxHash 64 | */ 65 | public function setMailboxHash(mixed $MailboxHash): PostmarkAddressFull 66 | { 67 | $this->MailboxHash = $MailboxHash; 68 | 69 | return $this; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkAgentInfo.php: -------------------------------------------------------------------------------- 1 | Name = !empty($values['Name']) ? $values['Name'] : ''; 14 | $this->Company = !empty($values['Company']) ? $values['Company'] : ''; 15 | $this->Family = !empty($values['Family']) ? $values['Family'] : ''; 16 | } 17 | 18 | public function getName(): string 19 | { 20 | return $this->Name; 21 | } 22 | 23 | public function setName(string $Name): PostmarkAgentInfo 24 | { 25 | $this->Name = $Name; 26 | 27 | return $this; 28 | } 29 | 30 | public function getCompany(): string 31 | { 32 | return $this->Company; 33 | } 34 | 35 | public function setCompany(string $Company): PostmarkAgentInfo 36 | { 37 | $this->Company = $Company; 38 | 39 | return $this; 40 | } 41 | 42 | public function getFamily(): string 43 | { 44 | return $this->Family; 45 | } 46 | 47 | public function setFamily(string $Family): PostmarkAgentInfo 48 | { 49 | $this->Family = $Family; 50 | 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkAttachment.php: -------------------------------------------------------------------------------- 1 | name = $attachmentName; 18 | $this->data = $base64EncodedData; 19 | $this->mimeType = $mimeType; 20 | $this->contentId = $contentId; 21 | } 22 | 23 | public static function fromRawData($data, $attachmentName, $mimeType = null, $contentId = null) 24 | { 25 | return new PostmarkAttachment(base64_encode($data), $attachmentName, $mimeType, $contentId); 26 | } 27 | 28 | public static function fromBase64EncodedData($base64EncodedData, $attachmentName, $mimeType = null, $contentId = null) 29 | { 30 | return new PostmarkAttachment($base64EncodedData, $attachmentName, $mimeType, $contentId); 31 | } 32 | 33 | public static function fromFile($filePath, $attachmentName, $mimeType = null, $contentId = null) 34 | { 35 | return new PostmarkAttachment(base64_encode(file_get_contents($filePath)), $attachmentName, $mimeType, $contentId); 36 | } 37 | 38 | #[ReturnTypeWillChange] 39 | public function jsonSerialize() 40 | { 41 | return [ 42 | 'Name' => $this->name, 43 | 'Content' => $this->data, 44 | 'ContentType' => $this->mimeType ? $this->mimeType : 'application/octet-stream', 45 | 'ContentId' => $this->contentId ? $this->contentId : $this->name, 46 | ]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkBounce.php: -------------------------------------------------------------------------------- 1 | RecordType = !empty($values['RecordType']) ? $values['RecordType'] : ''; 30 | $this->ID = !empty($values['ID']) ? $values['ID'] : 0; 31 | $this->Type = !empty($values['Type']) ? $values['Type'] : 0; 32 | $this->TypeCode = !empty($values['TypeCode']) ? $values['TypeCode'] : ''; 33 | $this->Name = !empty($values['Name']) ? $values['Name'] : ''; 34 | $this->Tag = !empty($values['Tag']) ? $values['Tag'] : ''; 35 | $this->MessageID = !empty($values['MessageID']) ? $values['MessageID'] : ''; 36 | $this->ServerID = !empty($values['ServerID']) ? $values['ServerID'] : 0; 37 | $this->MessageStream = !empty($values['MessageStream']) ? $values['MessageStream'] : ''; 38 | $this->Description = !empty($values['Description']) ? $values['Description'] : ''; 39 | $this->Details = !empty($values['Details']) ? $values['Details'] : ''; 40 | $this->Email = !empty($values['Email']) ? $values['Email'] : ''; 41 | $this->From = !empty($values['From']) ? $values['From'] : ''; 42 | $this->BouncedAt = !empty($values['BouncedAt']) ? $values['BouncedAt'] : ''; 43 | $this->DumpAvailable = !empty($values['DumpAvailable']) ? $values['DumpAvailable'] : false; 44 | $this->Inactive = !empty($values['Inactive']) ? $values['Inactive'] : false; 45 | $this->CanActivate = !empty($values['CanActivate']) ? $values['CanActivate'] : false; 46 | $this->Subject = !empty($values['Subject']) ? $values['Subject'] : ''; 47 | $this->Content = !empty($values['Content']) ? $values['Content'] : ''; 48 | } 49 | 50 | public function getRecordType(): mixed 51 | { 52 | return $this->RecordType; 53 | } 54 | 55 | public function setRecordType(mixed $RecordType): PostmarkBounce 56 | { 57 | $this->RecordType = $RecordType; 58 | 59 | return $this; 60 | } 61 | 62 | public function getID(): int 63 | { 64 | return $this->ID; 65 | } 66 | 67 | public function setID(int $ID): PostmarkBounce 68 | { 69 | $this->ID = $ID; 70 | 71 | return $this; 72 | } 73 | 74 | public function getType(): string 75 | { 76 | return $this->Type; 77 | } 78 | 79 | public function setType(string $Type): PostmarkBounce 80 | { 81 | $this->Type = $Type; 82 | 83 | return $this; 84 | } 85 | 86 | public function getTypeCode(): int 87 | { 88 | return $this->TypeCode; 89 | } 90 | 91 | public function setTypeCode(int $TypeCode): PostmarkBounce 92 | { 93 | $this->TypeCode = $TypeCode; 94 | 95 | return $this; 96 | } 97 | 98 | public function getName(): string 99 | { 100 | return $this->Name; 101 | } 102 | 103 | public function setName(string $Name): PostmarkBounce 104 | { 105 | $this->Name = $Name; 106 | 107 | return $this; 108 | } 109 | 110 | public function getTag(): string 111 | { 112 | return $this->Tag; 113 | } 114 | 115 | public function setTag(string $Tag): PostmarkBounce 116 | { 117 | $this->Tag = $Tag; 118 | 119 | return $this; 120 | } 121 | 122 | public function getMessageID(): string 123 | { 124 | return $this->MessageID; 125 | } 126 | 127 | public function setMessageID(string $MessageID): PostmarkBounce 128 | { 129 | $this->MessageID = $MessageID; 130 | 131 | return $this; 132 | } 133 | 134 | public function getServerID(): int 135 | { 136 | return $this->ServerID; 137 | } 138 | 139 | public function setServerID(int $ServerID): PostmarkBounce 140 | { 141 | $this->ServerID = $ServerID; 142 | 143 | return $this; 144 | } 145 | 146 | public function getMessageStream(): string 147 | { 148 | return $this->MessageStream; 149 | } 150 | 151 | public function setMessageStream(string $MessageStream): PostmarkBounce 152 | { 153 | $this->MessageStream = $MessageStream; 154 | 155 | return $this; 156 | } 157 | 158 | public function getDescription(): string 159 | { 160 | return $this->Description; 161 | } 162 | 163 | public function setDescription(string $Description): PostmarkBounce 164 | { 165 | $this->Description = $Description; 166 | 167 | return $this; 168 | } 169 | 170 | public function getDetails(): string 171 | { 172 | return $this->Details; 173 | } 174 | 175 | public function setDetails(string $Details): PostmarkBounce 176 | { 177 | $this->Details = $Details; 178 | 179 | return $this; 180 | } 181 | 182 | public function getEmail(): string 183 | { 184 | return $this->Email; 185 | } 186 | 187 | public function setEmail(string $Email): PostmarkBounce 188 | { 189 | $this->Email = $Email; 190 | 191 | return $this; 192 | } 193 | 194 | public function getFrom(): string 195 | { 196 | return $this->From; 197 | } 198 | 199 | public function setFrom(string $From): PostmarkBounce 200 | { 201 | $this->From = $From; 202 | 203 | return $this; 204 | } 205 | 206 | public function getBouncedAt(): string 207 | { 208 | return $this->BouncedAt; 209 | } 210 | 211 | public function setBouncedAt(string $BouncedAt): PostmarkBounce 212 | { 213 | $this->BouncedAt = $BouncedAt; 214 | 215 | return $this; 216 | } 217 | 218 | public function getDumpAvailable(): bool 219 | { 220 | return $this->DumpAvailable; 221 | } 222 | 223 | public function setDumpAvailable(bool $DumpAvailable): PostmarkBounce 224 | { 225 | $this->DumpAvailable = $DumpAvailable; 226 | 227 | return $this; 228 | } 229 | 230 | public function getInactive(): bool 231 | { 232 | return $this->Inactive; 233 | } 234 | 235 | public function setInactive(bool $Inactive): PostmarkBounce 236 | { 237 | $this->Inactive = $Inactive; 238 | 239 | return $this; 240 | } 241 | 242 | public function getCanActivate(): bool 243 | { 244 | return $this->CanActivate; 245 | } 246 | 247 | public function setCanActivate(bool $CanActivate): PostmarkBounce 248 | { 249 | $this->CanActivate = $CanActivate; 250 | 251 | return $this; 252 | } 253 | 254 | public function getSubject(): string 255 | { 256 | return $this->Subject; 257 | } 258 | 259 | public function setSubject(string $Subject): PostmarkBounce 260 | { 261 | $this->Subject = $Subject; 262 | 263 | return $this; 264 | } 265 | 266 | public function getContent(): string 267 | { 268 | return $this->Content; 269 | } 270 | 271 | public function setContent(string $Content): PostmarkBounce 272 | { 273 | $this->Content = $Content; 274 | 275 | return $this; 276 | } 277 | } 278 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkBounceActivation.php: -------------------------------------------------------------------------------- 1 | Message = !empty($values['Message']) ? $values['Message'] : ''; 13 | $this->setBounce(!empty($values['Bounce']) ? $values['Bounce'] : []); 14 | } 15 | 16 | /** 17 | * @return mixed|string 18 | */ 19 | public function getMessage(): mixed 20 | { 21 | return $this->Message; 22 | } 23 | 24 | /** 25 | * @param mixed|string $Message 26 | */ 27 | public function setMessage(mixed $Message): PostmarkBounceActivation 28 | { 29 | $this->Message = $Message; 30 | 31 | return $this; 32 | } 33 | 34 | /** 35 | * @return mixed|PostmarkBounce 36 | */ 37 | public function getBounce(): mixed 38 | { 39 | return $this->Bounce; 40 | } 41 | 42 | public function setBounce(array $Bounce): PostmarkBounceActivation 43 | { 44 | $this->Bounce = new PostmarkBounce($Bounce); 45 | 46 | return $this; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkBounceDump.php: -------------------------------------------------------------------------------- 1 | Body = !empty($values['Body']) ? $values['Body'] : ''; 12 | } 13 | 14 | public function getBody(): string 15 | { 16 | return $this->Body; 17 | } 18 | 19 | public function setBody(string $Body): PostmarkBounceDump 20 | { 21 | $this->Body = $Body; 22 | 23 | return $this; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkBounceList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempBounce = []; 14 | foreach ($values['Bounces'] as $bounce) { 15 | $obj = json_decode(json_encode($bounce)); 16 | $postmarkBounce = new PostmarkBounce((array) $obj); 17 | 18 | $tempBounce[] = $postmarkBounce; 19 | } 20 | $this->Bounces = $tempBounce; 21 | } 22 | 23 | public function getTotalCount(): int 24 | { 25 | return $this->TotalCount; 26 | } 27 | 28 | public function setTotalCount(int $TotalCount): PostmarkBounceList 29 | { 30 | $this->TotalCount = $TotalCount; 31 | 32 | return $this; 33 | } 34 | 35 | public function getBounces(): array 36 | { 37 | return $this->Bounces; 38 | } 39 | 40 | public function setBounces(array $Bounces): PostmarkBounceList 41 | { 42 | $this->Bounces = $Bounces; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkBounceSummary.php: -------------------------------------------------------------------------------- 1 | Type = !empty($values['Type']) ? $values['Type'] : ''; 14 | $this->Name = !empty($values['Name']) ? $values['Name'] : ''; 15 | $this->Count = !empty($values['FirstOpen']) ? $values['FirstOpen'] : 0; 16 | } 17 | 18 | public function getType(): string 19 | { 20 | return $this->Type; 21 | } 22 | 23 | public function setType(string $Type): PostmarkBounceSummary 24 | { 25 | $this->Type = $Type; 26 | 27 | return $this; 28 | } 29 | 30 | public function getName(): string 31 | { 32 | return $this->Name; 33 | } 34 | 35 | public function setName(string $Name): PostmarkBounceSummary 36 | { 37 | $this->Name = $Name; 38 | 39 | return $this; 40 | } 41 | 42 | public function getCount(): int 43 | { 44 | return $this->Count; 45 | } 46 | 47 | public function setCount(int $Count): PostmarkBounceSummary 48 | { 49 | $this->Count = $Count; 50 | 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkClick.php: -------------------------------------------------------------------------------- 1 | OriginalLink = !empty($values['OriginalLink']) ? $values['OriginalLink'] : false; 18 | $this->MessageID = !empty($values['MessageID']) ? $values['MessageID'] : ''; 19 | $this->UserAgent = !empty($values['UserAgent']) ? $values['UserAgent'] : ''; 20 | !empty($values['Geo']) ? $this->setGeo($values['Geo']) : $this->setGeo(null); 21 | $this->Platform = !empty($values['Platform']) ? $values['Platform'] : ''; 22 | !empty($values['Client']) ? $this->setClient($values['Client']) : $this->setClient(null); 23 | !empty($values['OS']) ? $this->setOS($values['OS']) : $this->setOS(null); 24 | } 25 | 26 | /** 27 | * @return bool|mixed|string 28 | */ 29 | public function getOriginalLink(): mixed 30 | { 31 | return $this->OriginalLink; 32 | } 33 | 34 | /** 35 | * @param bool|mixed|string $OriginalLink 36 | */ 37 | public function setOriginalLink(mixed $OriginalLink): PostmarkClick 38 | { 39 | $this->OriginalLink = $OriginalLink; 40 | 41 | return $this; 42 | } 43 | 44 | /** 45 | * @return mixed|string 46 | */ 47 | public function getMessageID(): mixed 48 | { 49 | return $this->MessageID; 50 | } 51 | 52 | /** 53 | * @param mixed|string $MessageID 54 | */ 55 | public function setMessageID(mixed $MessageID): PostmarkClick 56 | { 57 | $this->MessageID = $MessageID; 58 | 59 | return $this; 60 | } 61 | 62 | /** 63 | * @return mixed|string 64 | */ 65 | public function getUserAgent(): mixed 66 | { 67 | return $this->UserAgent; 68 | } 69 | 70 | /** 71 | * @param mixed|string $UserAgent 72 | */ 73 | public function setUserAgent(mixed $UserAgent): PostmarkClick 74 | { 75 | $this->UserAgent = $UserAgent; 76 | 77 | return $this; 78 | } 79 | 80 | /** 81 | * @return null|mixed|PostmarkGeographyInfo 82 | */ 83 | public function getGeo(): mixed 84 | { 85 | return $this->Geo; 86 | } 87 | 88 | public function setGeo(mixed $Geo): PostmarkClick 89 | { 90 | if (is_object($Geo)) { 91 | $Geo = new PostmarkGeographyInfo((array) $Geo); 92 | } 93 | $this->Geo = $Geo; 94 | 95 | return $this; 96 | } 97 | 98 | /** 99 | * @return mixed|string 100 | */ 101 | public function getPlatform(): mixed 102 | { 103 | return $this->Platform; 104 | } 105 | 106 | /** 107 | * @param mixed|string $Platform 108 | */ 109 | public function setPlatform(mixed $Platform): PostmarkClick 110 | { 111 | $this->Platform = $Platform; 112 | 113 | return $this; 114 | } 115 | 116 | public function getClient(): mixed 117 | { 118 | return $this->Client; 119 | } 120 | 121 | /** 122 | * @param null|mixed|PostmarkAgentInfo $Client 123 | */ 124 | public function setClient(mixed $Client): PostmarkClick 125 | { 126 | if (is_object($Client)) { 127 | $Client = new PostmarkAgentInfo((array) $Client); 128 | } 129 | $this->Client = $Client; 130 | 131 | return $this; 132 | } 133 | 134 | /** 135 | * @return null|mixed|PostmarkAgentInfo 136 | */ 137 | public function getOS(): mixed 138 | { 139 | return $this->OS; 140 | } 141 | 142 | /** 143 | * @param null|mixed|PostmarkAgentInfo $OS 144 | */ 145 | public function setOS(mixed $OS): PostmarkClick 146 | { 147 | if (is_object($OS)) { 148 | $OS = new PostmarkAgentInfo((array) $OS); 149 | } 150 | $this->OS = $OS; 151 | 152 | return $this; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkClickList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempClicks = []; 14 | foreach ($values['Clicks'] as $click) { 15 | $obj = json_decode(json_encode($click)); 16 | $postmarkClick = new PostmarkClick((array) $obj); 17 | 18 | $tempClicks[] = $postmarkClick; 19 | } 20 | $this->Clicks = $tempClicks; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkClickList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getClicks(): array 42 | { 43 | return $this->Clicks; 44 | } 45 | 46 | public function setClicks(array $Clicks): PostmarkClickList 47 | { 48 | $this->Clicks = $Clicks; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkDeliveryStats.php: -------------------------------------------------------------------------------- 1 | InactiveMails = !empty($values['InactiveMails']) ? $values['InactiveMails'] : 0; 13 | $tempBounces = []; 14 | foreach ($values['Bounces'] as $bounce) { 15 | $obj = json_decode(json_encode($bounce)); 16 | $postmarkBounce = new PostmarkBounceSummary((array) $obj); 17 | 18 | $tempBounces[] = $postmarkBounce; 19 | } 20 | $this->Bounces = $tempBounces; 21 | } 22 | 23 | public function getInactiveMails(): int 24 | { 25 | return $this->InactiveMails; 26 | } 27 | 28 | public function setInactiveMails(int $InactiveMails): PostmarkDeliveryStats 29 | { 30 | $this->InactiveMails = $InactiveMails; 31 | 32 | return $this; 33 | } 34 | 35 | public function getBounces(): array 36 | { 37 | return $this->Bounces; 38 | } 39 | 40 | public function setBounces(array $Bounces): PostmarkDeliveryStats 41 | { 42 | $this->Bounces = $Bounces; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkDomain.php: -------------------------------------------------------------------------------- 1 | ID = !empty($values['ID']) ? $values['ID'] : 0; 18 | $this->Name = !empty($values['Name']) ? $values['Name'] : ''; 19 | $this->SPFVerified = !empty($values['SPFVerified']) ? $values['SPFVerified'] : false; 20 | $this->DKIMVerified = !empty($values['DKIMVerified']) ? $values['DKIMVerified'] : false; 21 | $this->WeakDKIM = !empty($values['WeakDKIM']) ? $values['WeakDKIM'] : false; 22 | $this->ReturnPathDomainVerified = !empty($values['ReturnPathDomainVerified']) ? $values['ReturnPathDomainVerified'] : false; 23 | $this->CustomTrackingVerified = !empty($values['CustomTrackingVerified']) ? $values['CustomTrackingVerified'] : false; 24 | } 25 | 26 | public function getID(): int 27 | { 28 | return $this->ID; 29 | } 30 | 31 | public function setID(int $ID): PostmarkDomain 32 | { 33 | $this->ID = $ID; 34 | 35 | return $this; 36 | } 37 | 38 | public function getName(): string 39 | { 40 | return $this->Name; 41 | } 42 | 43 | public function setName(string $Name): PostmarkDomain 44 | { 45 | $this->Name = $Name; 46 | 47 | return $this; 48 | } 49 | 50 | public function isSPFVerified(): bool 51 | { 52 | return $this->SPFVerified; 53 | } 54 | 55 | public function setSPFVerified(bool $SPFVerified): PostmarkDomain 56 | { 57 | $this->SPFVerified = $SPFVerified; 58 | 59 | return $this; 60 | } 61 | 62 | public function isDKIMVerified(): bool 63 | { 64 | return $this->DKIMVerified; 65 | } 66 | 67 | public function setDKIMVerified(bool $DKIMVerified): PostmarkDomain 68 | { 69 | $this->DKIMVerified = $DKIMVerified; 70 | 71 | return $this; 72 | } 73 | 74 | public function isWeakDKIM(): bool 75 | { 76 | return $this->WeakDKIM; 77 | } 78 | 79 | public function setWeakDKIM(bool $WeakDKIM): PostmarkDomain 80 | { 81 | $this->WeakDKIM = $WeakDKIM; 82 | 83 | return $this; 84 | } 85 | 86 | public function isReturnPathDomainVerified(): bool 87 | { 88 | return $this->ReturnPathDomainVerified; 89 | } 90 | 91 | public function setReturnPathDomainVerified(bool $ReturnPathDomainVerified): PostmarkDomain 92 | { 93 | $this->ReturnPathDomainVerified = $ReturnPathDomainVerified; 94 | 95 | return $this; 96 | } 97 | 98 | public function getCustomTrackingVerified(): bool 99 | { 100 | return $this->CustomTrackingVerified; 101 | } 102 | 103 | public function setCustomTrackingVerified(bool $CustomTrackingVerified): PostmarkDomain 104 | { 105 | $this->CustomTrackingVerified = $CustomTrackingVerified; 106 | 107 | return $this; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkDomainDetails.php: -------------------------------------------------------------------------------- 1 | SPFHost = !empty($values['SPFHost']) ? $values['SPFHost'] : ''; 28 | $this->SPFTextValue = !empty($values['SPFTextValue']) ? $values['SPFTextValue'] : ''; 29 | $this->DKIMHost = !empty($values['DKIMHost']) ? $values['DKIMHost'] : ''; 30 | $this->DKIMTextValue = !empty($values['DKIMTextValue']) ? $values['DKIMTextValue'] : ''; 31 | $this->DKIMPendingHost = !empty($values['DKIMPendingHost']) ? $values['DKIMPendingHost'] : ''; 32 | $this->DKIMPendingTextValue = !empty($values['DKIMPendingTextValue']) ? $values['DKIMPendingTextValue'] : ''; 33 | $this->DKIMRevokedHost = !empty($values['DKIMRevokedHost']) ? $values['DKIMRevokedHost'] : ''; 34 | $this->DKIMRevokedTextValue = !empty($values['DKIMRevokedTextValue']) ? $values['DKIMRevokedTextValue'] : ''; 35 | $this->SafeToRemoveRevokedKeyFromDNS = !empty($values['SafeToRemoveRevokedKeyFromDNS']) ? $values['SafeToRemoveRevokedKeyFromDNS'] : false; 36 | $this->DKIMUpdateStatus = !empty($values['DKIMUpdateStatus']) ? $values['DKIMUpdateStatus'] : ''; 37 | $this->ReturnPathDomain = !empty($values['ReturnPathDomain']) ? $values['ReturnPathDomain'] : ''; 38 | $this->ReturnPathDomainCNAMEValue = !empty($values['ReturnPathDomainCNAMEValue']) ? $values['ReturnPathDomainCNAMEValue'] : ''; 39 | 40 | $this->CustomTrackingDomainCNAMEValue = !empty($values['CustomTrackingDomainCNAMEValue']) ? $values['CustomTrackingDomainCNAMEValue'] : ''; 41 | $this->CustomTrackingDomain = !empty($values['CustomTrackingDomain']) ? $values['CustomTrackingDomain'] : ''; 42 | } 43 | 44 | public function getSPFHost(): ?string 45 | { 46 | return $this->SPFHost; 47 | } 48 | 49 | public function setSPFHost(?string $SPFHost): PostmarkDomainDetails 50 | { 51 | $this->SPFHost = $SPFHost; 52 | 53 | return $this; 54 | } 55 | 56 | public function getSPFTextValue(): ?string 57 | { 58 | return $this->SPFTextValue; 59 | } 60 | 61 | public function setSPFTextValue(?string $SPFTextValue): PostmarkDomainDetails 62 | { 63 | $this->SPFTextValue = $SPFTextValue; 64 | 65 | return $this; 66 | } 67 | 68 | public function getDKIMHost(): ?string 69 | { 70 | return $this->DKIMHost; 71 | } 72 | 73 | public function setDKIMHost(?string $DKIMHost): PostmarkDomainDetails 74 | { 75 | $this->DKIMHost = $DKIMHost; 76 | 77 | return $this; 78 | } 79 | 80 | public function getDKIMTextValue(): ?string 81 | { 82 | return $this->DKIMTextValue; 83 | } 84 | 85 | public function setDKIMTextValue(?string $DKIMTextValue): PostmarkDomainDetails 86 | { 87 | $this->DKIMTextValue = $DKIMTextValue; 88 | 89 | return $this; 90 | } 91 | 92 | public function getDKIMPendingHost(): ?string 93 | { 94 | return $this->DKIMPendingHost; 95 | } 96 | 97 | public function setDKIMPendingHost(?string $DKIMPendingHost): PostmarkDomainDetails 98 | { 99 | $this->DKIMPendingHost = $DKIMPendingHost; 100 | 101 | return $this; 102 | } 103 | 104 | public function getDKIMPendingTextValue(): ?string 105 | { 106 | return $this->DKIMPendingTextValue; 107 | } 108 | 109 | public function setDKIMPendingTextValue(?string $DKIMPendingTextValue): PostmarkDomainDetails 110 | { 111 | $this->DKIMPendingTextValue = $DKIMPendingTextValue; 112 | 113 | return $this; 114 | } 115 | 116 | public function getDKIMRevokedHost(): ?string 117 | { 118 | return $this->DKIMRevokedHost; 119 | } 120 | 121 | public function setDKIMRevokedHost(?string $DKIMRevokedHost): PostmarkDomainDetails 122 | { 123 | $this->DKIMRevokedHost = $DKIMRevokedHost; 124 | 125 | return $this; 126 | } 127 | 128 | public function getDKIMRevokedTextValue(): ?string 129 | { 130 | return $this->DKIMRevokedTextValue; 131 | } 132 | 133 | public function setDKIMRevokedTextValue(?string $DKIMRevokedTextValue): PostmarkDomainDetails 134 | { 135 | $this->DKIMRevokedTextValue = $DKIMRevokedTextValue; 136 | 137 | return $this; 138 | } 139 | 140 | public function isSafeToRemoveRevokedKeyFromDNS(): bool 141 | { 142 | return $this->SafeToRemoveRevokedKeyFromDNS; 143 | } 144 | 145 | public function setSafeToRemoveRevokedKeyFromDNS(bool $SafeToRemoveRevokedKeyFromDNS): PostmarkDomainDetails 146 | { 147 | $this->SafeToRemoveRevokedKeyFromDNS = $SafeToRemoveRevokedKeyFromDNS; 148 | 149 | return $this; 150 | } 151 | 152 | public function getDKIMUpdateStatus(): ?string 153 | { 154 | return $this->DKIMUpdateStatus; 155 | } 156 | 157 | public function setDKIMUpdateStatus(?string $DKIMUpdateStatus): PostmarkDomainDetails 158 | { 159 | $this->DKIMUpdateStatus = $DKIMUpdateStatus; 160 | 161 | return $this; 162 | } 163 | 164 | public function getReturnPathDomain(): ?string 165 | { 166 | return $this->ReturnPathDomain; 167 | } 168 | 169 | public function setReturnPathDomain(?string $ReturnPathDomain): PostmarkDomainDetails 170 | { 171 | $this->ReturnPathDomain = $ReturnPathDomain; 172 | 173 | return $this; 174 | } 175 | 176 | public function getReturnPathDomainCNAMEValue(): ?string 177 | { 178 | return $this->ReturnPathDomainCNAMEValue; 179 | } 180 | 181 | public function setReturnPathDomainCNAMEValue(?string $ReturnPathDomainCNAMEValue): PostmarkDomainDetails 182 | { 183 | $this->ReturnPathDomainCNAMEValue = $ReturnPathDomainCNAMEValue; 184 | 185 | return $this; 186 | } 187 | 188 | public function getCustomTrackingDomainCNAMEValue(): ?string 189 | { 190 | return $this->CustomTrackingDomainCNAMEValue; 191 | } 192 | 193 | public function setCustomTrackingDomainCNAMEValue(?string $CustomTrackingDomainCNAMEValue): PostmarkDomainDetails 194 | { 195 | $this->CustomTrackingDomainCNAMEValue = $CustomTrackingDomainCNAMEValue; 196 | 197 | return $this; 198 | } 199 | 200 | public function getCustomTrackingDomain(): ?string 201 | { 202 | return $this->CustomTrackingDomain; 203 | } 204 | 205 | public function setCustomTrackingDomain(?string $CustomTrackingDomain): PostmarkDomainDetails 206 | { 207 | $this->CustomTrackingDomain = $CustomTrackingDomain; 208 | 209 | return $this; 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkDomainList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempDomains = []; 14 | foreach ($values['Domains'] as $domain) { 15 | $obj = json_decode(json_encode($domain)); 16 | $postmarkDomain = new PostmarkDomain((array) $obj); 17 | 18 | $tempDomains[] = $postmarkDomain; 19 | } 20 | $this->Domains = $tempDomains; 21 | } 22 | 23 | public function getTotalCount(): int 24 | { 25 | return $this->TotalCount; 26 | } 27 | 28 | public function setTotalCount(int $TotalCount): PostmarkDomainList 29 | { 30 | $this->TotalCount = $TotalCount; 31 | 32 | return $this; 33 | } 34 | 35 | public function getDomains(): array 36 | { 37 | return $this->Domains; 38 | } 39 | 40 | public function setDomains(array $Domains): PostmarkDomainList 41 | { 42 | $this->Domains = $Domains; 43 | 44 | return $this; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkException.php: -------------------------------------------------------------------------------- 1 | PostmarkApiErrorCode; 24 | } 25 | 26 | /** 27 | * @param mixed $postmarkApiErrorCode 28 | * 29 | * @return PostmarkException 30 | */ 31 | public function setPostmarkApiErrorCode($postmarkApiErrorCode) 32 | { 33 | $this->PostmarkApiErrorCode = $postmarkApiErrorCode; 34 | 35 | return $this; 36 | } 37 | 38 | /** 39 | * @return mixed 40 | */ 41 | public function getHttpStatusCode() 42 | { 43 | return $this->HttpStatusCode; 44 | } 45 | 46 | /** 47 | * @param mixed $httpStatusCode 48 | * 49 | * @return PostmarkException 50 | */ 51 | public function setHttpStatusCode($httpStatusCode) 52 | { 53 | $this->HttpStatusCode = $httpStatusCode; 54 | 55 | return $this; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkGeographyInfo.php: -------------------------------------------------------------------------------- 1 | City = !empty($values['City']) ? $values['City'] : ''; 18 | $this->Region = !empty($values['Region']) ? $values['Region'] : ''; 19 | $this->Country = !empty($values['Country']) ? $values['Country'] : ''; 20 | $this->IP = !empty($values['IP']) ? $values['IP'] : ''; 21 | $this->RegionISOCode = !empty($values['RegionISOCode']) ? $values['RegionISOCode'] : ''; 22 | $this->CountryISOCode = !empty($values['CountryISOCode']) ? $values['CountryISOCode'] : ''; 23 | $this->Coords = !empty($values['Coords']) ? $values['Coords'] : ''; 24 | } 25 | 26 | public function getCity(): string 27 | { 28 | return $this->City; 29 | } 30 | 31 | public function setCity(string $City): PostmarkGeographyInfo 32 | { 33 | $this->City = $City; 34 | 35 | return $this; 36 | } 37 | 38 | public function getRegion(): string 39 | { 40 | return $this->Region; 41 | } 42 | 43 | public function setRegion(string $Region): PostmarkGeographyInfo 44 | { 45 | $this->Region = $Region; 46 | 47 | return $this; 48 | } 49 | 50 | public function getCountry(): string 51 | { 52 | return $this->Country; 53 | } 54 | 55 | public function setCountry(string $Country): PostmarkGeographyInfo 56 | { 57 | $this->Country = $Country; 58 | 59 | return $this; 60 | } 61 | 62 | public function getIP(): string 63 | { 64 | return $this->IP; 65 | } 66 | 67 | public function setIP(string $IP): PostmarkGeographyInfo 68 | { 69 | $this->IP = $IP; 70 | 71 | return $this; 72 | } 73 | 74 | public function getRegionISOCode(): string 75 | { 76 | return $this->RegionISOCode; 77 | } 78 | 79 | public function setRegionISOCode(string $RegionISOCode): PostmarkGeographyInfo 80 | { 81 | $this->RegionISOCode = $RegionISOCode; 82 | 83 | return $this; 84 | } 85 | 86 | public function getCountryISOCode(): string 87 | { 88 | return $this->CountryISOCode; 89 | } 90 | 91 | public function setCountryISOCode(string $CountryISOCode): PostmarkGeographyInfo 92 | { 93 | $this->CountryISOCode = $CountryISOCode; 94 | 95 | return $this; 96 | } 97 | 98 | public function getCoords(): string 99 | { 100 | return $this->Coords; 101 | } 102 | 103 | public function setCoords(string $Coords): PostmarkGeographyInfo 104 | { 105 | $this->Coords = $Coords; 106 | 107 | return $this; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkInboundMessageList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempInboundMessages = []; 14 | foreach ($values['InboundMessages'] as $message) { 15 | $obj = json_decode(json_encode($message)); 16 | $postmarkMessage = new PostmarkInboundMessage((array) $obj); 17 | 18 | $tempInboundMessages[] = $postmarkMessage; 19 | } 20 | $this->InboundMessages = $tempInboundMessages; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkInboundMessageList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getInboundMessages(): array 42 | { 43 | return $this->InboundMessages; 44 | } 45 | 46 | public function setInboundMessages(array $InboundMessages): PostmarkInboundMessageList 47 | { 48 | $this->InboundMessages = $InboundMessages; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkInboundRuleTrigger.php: -------------------------------------------------------------------------------- 1 | ID = !empty($values['ID']) ? $values['ID'] : 0; 13 | $this->Rule = !empty($values['Rule']) ? $values['Rule'] : ''; 14 | } 15 | 16 | public function getID(): int 17 | { 18 | return $this->ID; 19 | } 20 | 21 | public function setID(int $ID): PostmarkInboundRuleTrigger 22 | { 23 | $this->ID = $ID; 24 | 25 | return $this; 26 | } 27 | 28 | public function getRule(): string 29 | { 30 | return $this->Rule; 31 | } 32 | 33 | public function setRule(string $Rule): PostmarkInboundRuleTrigger 34 | { 35 | $this->Rule = $Rule; 36 | 37 | return $this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkInboundRuleTriggerList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempRules = []; 14 | foreach ($values['InboundRules'] as $rule) { 15 | $obj = json_decode(json_encode($rule)); 16 | $postmarkServer = new PostmarkInboundRuleTrigger((array) $obj); 17 | 18 | $tempRules[] = $postmarkServer; 19 | } 20 | $this->Rules = $tempRules; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkInboundRuleTriggerList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getRules(): array 42 | { 43 | return $this->Rules; 44 | } 45 | 46 | public function setRules(array $Rules): PostmarkInboundRuleTriggerList 47 | { 48 | $this->Rules = $Rules; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkMessage.php: -------------------------------------------------------------------------------- 1 | Subject = !empty($values['Subject']) ? $values['Subject'] : ''; 14 | $this->HtmlBody = !empty($values['HtmlBody']) ? $values['HtmlBody'] : ''; 15 | $this->TextBody = !empty($values['TextBody']) ? $values['TextBody'] : ''; 16 | 17 | parent::__construct($values); 18 | } 19 | 20 | public function getSubject(): string 21 | { 22 | return $this->Subject; 23 | } 24 | 25 | public function setSubject(string $Subject): PostmarkMessage 26 | { 27 | $this->Subject = $Subject; 28 | 29 | return $this; 30 | } 31 | 32 | public function getHtmlBody(): string 33 | { 34 | return $this->HtmlBody; 35 | } 36 | 37 | public function setHtmlBody(string $HtmlBody): PostmarkMessage 38 | { 39 | $this->HtmlBody = $HtmlBody; 40 | 41 | return $this; 42 | } 43 | 44 | public function getTextBody(): string 45 | { 46 | return $this->TextBody; 47 | } 48 | 49 | public function setTextBody(string $TextBody): PostmarkMessage 50 | { 51 | $this->TextBody = $TextBody; 52 | 53 | return $this; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkMessageBase.php: -------------------------------------------------------------------------------- 1 | From = !empty($values['From']) ? $values['From'] : ''; 23 | $this->To = !empty($values['To']) ? $values['To'] : ''; 24 | $this->Tag = !empty($values['Tag']) ? $values['Tag'] : ''; 25 | $this->TrackOpens = !empty($values['TrackOpens']) ? $values['TrackOpens'] : false; 26 | $this->ReplyTo = !empty($values['ReplyTo']) ? $values['ReplyTo'] : ''; 27 | $this->Cc = !empty($values['Cc']) ? $values['Cc'] : ''; 28 | $this->Bcc = !empty($values['Bcc']) ? $values['Bcc'] : ''; 29 | $this->Headers = !empty($values['Headers']) ? $values['Headers'] : null; 30 | $this->Attachments = !empty($values['Attachments']) ? $values['Attachments'] : null; 31 | $this->TrackLinks = !empty($values['TrackLinks']) ? $values['TrackLinks'] : ''; 32 | $this->Metadata = !empty($values['Metadata']) ? $values['Metadata'] : null; 33 | $this->MessageStream = !empty($values['MessageStream']) ? $values['MessageStream'] : null; 34 | } 35 | 36 | public function getFrom(): string 37 | { 38 | return $this->From; 39 | } 40 | 41 | public function setFrom(string $From): PostmarkMessageBase 42 | { 43 | $this->From = $From; 44 | 45 | return $this; 46 | } 47 | 48 | public function getTo(): string 49 | { 50 | return $this->To; 51 | } 52 | 53 | public function setTo(string $To): PostmarkMessageBase 54 | { 55 | $this->To = $To; 56 | 57 | return $this; 58 | } 59 | 60 | public function getTag(): string 61 | { 62 | return $this->Tag; 63 | } 64 | 65 | public function setTag(string $Tag): PostmarkMessageBase 66 | { 67 | $this->Tag = $Tag; 68 | 69 | return $this; 70 | } 71 | 72 | public function getTrackOpens(): bool 73 | { 74 | return $this->TrackOpens; 75 | } 76 | 77 | public function setTrackOpens(bool $TrackOpens): PostmarkMessageBase 78 | { 79 | $this->TrackOpens = $TrackOpens; 80 | 81 | return $this; 82 | } 83 | 84 | /** 85 | * @return string 86 | */ 87 | public function getReplyTo(): mixed 88 | { 89 | return $this->ReplyTo; 90 | } 91 | 92 | public function setReplyTo(string $ReplyTo): PostmarkMessageBase 93 | { 94 | $this->ReplyTo = $ReplyTo; 95 | 96 | return $this; 97 | } 98 | 99 | /** 100 | * @return string 101 | */ 102 | public function getCc(): mixed 103 | { 104 | return $this->Cc; 105 | } 106 | 107 | public function setCc(string $Cc): PostmarkMessageBase 108 | { 109 | $this->Cc = $Cc; 110 | 111 | return $this; 112 | } 113 | 114 | /** 115 | * @return string 116 | */ 117 | public function getBcc(): mixed 118 | { 119 | return $this->Bcc; 120 | } 121 | 122 | public function setBcc(string $Bcc): PostmarkMessageBase 123 | { 124 | $this->Bcc = $Bcc; 125 | 126 | return $this; 127 | } 128 | 129 | /** 130 | * @return array 131 | */ 132 | public function getHeaders(): mixed 133 | { 134 | return $this->Headers; 135 | } 136 | 137 | public function setHeaders(?array $Headers): PostmarkMessageBase 138 | { 139 | $this->Headers = $Headers; 140 | 141 | return $this; 142 | } 143 | 144 | /** 145 | * @return array 146 | */ 147 | public function getAttachments(): mixed 148 | { 149 | return $this->Attachments; 150 | } 151 | 152 | public function setAttachments(array $Attachments): PostmarkMessageBase 153 | { 154 | $this->Attachments = $Attachments; 155 | 156 | return $this; 157 | } 158 | 159 | /** 160 | * @return string 161 | */ 162 | public function getTrackLinks(): mixed 163 | { 164 | return $this->TrackLinks; 165 | } 166 | 167 | public function setTrackLinks(string $TrackLinks): PostmarkMessageBase 168 | { 169 | $this->TrackLinks = $TrackLinks; 170 | 171 | return $this; 172 | } 173 | 174 | public function getMetadata(): array 175 | { 176 | return $this->Metadata; 177 | } 178 | 179 | /** 180 | * @param ?array $Metadata 181 | */ 182 | public function setMetadata(array $Metadata = null): PostmarkMessageBase 183 | { 184 | $this->Metadata = $Metadata; 185 | 186 | return $this; 187 | } 188 | 189 | public function getMessageStream(): string 190 | { 191 | return $this->MessageStream; 192 | } 193 | 194 | public function setMessageStream(string $MessageStream): PostmarkMessageBase 195 | { 196 | $this->MessageStream = $MessageStream; 197 | 198 | return $this; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkMessageDump.php: -------------------------------------------------------------------------------- 1 | Body = $body; 12 | } 13 | 14 | public function getBody(): string 15 | { 16 | return $this->Body; 17 | } 18 | 19 | public function setBody(string $Body): PostmarkMessageDump 20 | { 21 | $this->Body = $Body; 22 | 23 | return $this; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkMessageEvent.php: -------------------------------------------------------------------------------- 1 | Recipient = !empty($values['Recipient']) ? $values['Recipient'] : ''; 15 | $this->Type = !empty($values['Type']) ? $values['Type'] : ''; 16 | $this->ReceivedAt = !empty($values['ReceivedAt']) ? $values['ReceivedAt'] : ''; 17 | 18 | $arrayType = !empty($values['Details']) ? (array) $values['Details'] : []; 19 | $this->Details = !empty($values['Details']) ? new PostmarkMessageEventDetails( 20 | $arrayType 21 | ) : new PostmarkMessageEventDetails(); 22 | } 23 | 24 | public function getRecipient(): string 25 | { 26 | return $this->Recipient; 27 | } 28 | 29 | public function setRecipient(string $Recipient): PostmarkMessageEvent 30 | { 31 | $this->Recipient = $Recipient; 32 | 33 | return $this; 34 | } 35 | 36 | public function getType(): string 37 | { 38 | return $this->Type; 39 | } 40 | 41 | public function setType(string $Type): PostmarkMessageEvent 42 | { 43 | $this->Type = $Type; 44 | 45 | return $this; 46 | } 47 | 48 | public function getReceivedAt(): string 49 | { 50 | return $this->ReceivedAt; 51 | } 52 | 53 | public function setReceivedAt(string $ReceivedAt): PostmarkMessageEvent 54 | { 55 | $this->ReceivedAt = $ReceivedAt; 56 | 57 | return $this; 58 | } 59 | 60 | public function getDetails(): PostmarkMessageEventDetails 61 | { 62 | return $this->Details; 63 | } 64 | 65 | public function setDetails(PostmarkMessageEventDetails $Details): PostmarkMessageEvent 66 | { 67 | $this->Details = $Details; 68 | 69 | return $this; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkMessageEventDetails.php: -------------------------------------------------------------------------------- 1 | DeliveryMessage = !empty($values['DeliveryMessage']) ? $values['DeliveryMessage'] : ''; 20 | $this->DestinationServer = !empty($values['DestinationServer']) ? $values['DestinationServer'] : ''; 21 | $this->DestinationIP = !empty($values['DestinationIP']) ? $values['DestinationIP'] : ''; 22 | 23 | $this->Summary = !empty($values['Summary']) ? $values['Summary'] : ''; 24 | $this->BounceID = !empty($values['BounceID']) ? $values['BounceID'] : ''; 25 | $this->Origin = !empty($values['Origin']) ? $values['Origin'] : ''; 26 | $this->SuppressSending = !empty($values['SuppressSending']) ? $values['SuppressSending'] : ''; 27 | $this->Link = !empty($values['Link']) ? $values['Link'] : ''; 28 | $this->ClickLocation = !empty($values['ClickLocation']) ? $values['ClickLocation'] : ''; 29 | } 30 | 31 | public function getDeliveryMessage(): ?string 32 | { 33 | return $this->DeliveryMessage; 34 | } 35 | 36 | public function setDeliveryMessage(?string $DeliveryMessage): PostmarkMessageEventDetails 37 | { 38 | $this->DeliveryMessage = $DeliveryMessage; 39 | 40 | return $this; 41 | } 42 | 43 | public function getDestinationServer(): ?string 44 | { 45 | return $this->DestinationServer; 46 | } 47 | 48 | public function setDestinationServer(?string $DestinationServer): PostmarkMessageEventDetails 49 | { 50 | $this->DestinationServer = $DestinationServer; 51 | 52 | return $this; 53 | } 54 | 55 | public function getDestinationIP(): ?string 56 | { 57 | return $this->DestinationIP; 58 | } 59 | 60 | public function setDestinationIP(?string $DestinationIP): PostmarkMessageEventDetails 61 | { 62 | $this->DestinationIP = $DestinationIP; 63 | 64 | return $this; 65 | } 66 | 67 | public function getSummary(): ?string 68 | { 69 | return $this->Summary; 70 | } 71 | 72 | public function setSummary(?string $Summary): PostmarkMessageEventDetails 73 | { 74 | $this->Summary = $Summary; 75 | 76 | return $this; 77 | } 78 | 79 | public function getBounceID(): ?string 80 | { 81 | return $this->BounceID; 82 | } 83 | 84 | public function setBounceID(?string $BounceID): PostmarkMessageEventDetails 85 | { 86 | $this->BounceID = $BounceID; 87 | 88 | return $this; 89 | } 90 | 91 | public function getOrigin(): ?string 92 | { 93 | return $this->Origin; 94 | } 95 | 96 | public function setOrigin(?string $Origin): PostmarkMessageEventDetails 97 | { 98 | $this->Origin = $Origin; 99 | 100 | return $this; 101 | } 102 | 103 | public function getSuppressSending(): ?string 104 | { 105 | return $this->SuppressSending; 106 | } 107 | 108 | public function setSuppressSending(?string $SuppressSending): PostmarkMessageEventDetails 109 | { 110 | $this->SuppressSending = $SuppressSending; 111 | 112 | return $this; 113 | } 114 | 115 | public function getLink(): ?string 116 | { 117 | return $this->Link; 118 | } 119 | 120 | public function setLink(?string $Link): PostmarkMessageEventDetails 121 | { 122 | $this->Link = $Link; 123 | 124 | return $this; 125 | } 126 | 127 | public function getClickLocation(): ?string 128 | { 129 | return $this->ClickLocation; 130 | } 131 | 132 | public function setClickLocation(?string $ClickLocation): PostmarkMessageEventDetails 133 | { 134 | $this->ClickLocation = $ClickLocation; 135 | 136 | return $this; 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkMessageEvents.php: -------------------------------------------------------------------------------- 1 | MessageEvents = $tempMessageEvents; 19 | } 20 | 21 | public function getMessageEvents(): array 22 | { 23 | return $this->MessageEvents; 24 | } 25 | 26 | public function setMessageEvents(array $MessageEvents): PostmarkMessageEvents 27 | { 28 | $this->MessageEvents = $MessageEvents; 29 | 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkOpen.php: -------------------------------------------------------------------------------- 1 | FirstOpen = !empty($values['FirstOpen']) ? $values['FirstOpen'] : ''; 19 | $this->MessageID = !empty($values['MessageID']) ? $values['MessageID'] : ''; 20 | $this->UserAgent = !empty($values['UserAgent']) ? $values['UserAgent'] : ''; 21 | !empty($values['Geo']) ? $this->setGeo($values['Geo']) : $this->setGeo(null); 22 | $this->Platform = !empty($values['Platform']) ? $values['Platform'] : ''; 23 | $this->ReadSeconds = !empty($values['ReadSeconds']) ? $values['ReadSeconds'] : 0; 24 | !empty($values['Client']) ? $this->setClient($values['Client']) : $this->setClient(null); 25 | !empty($values['OS']) ? $this->setOS($values['OS']) : $this->setOS(null); 26 | } 27 | 28 | public function isFirstOpen(): bool 29 | { 30 | return $this->FirstOpen; 31 | } 32 | 33 | public function setFirstOpen(bool $FirstOpen): PostmarkOpen 34 | { 35 | $this->FirstOpen = $FirstOpen; 36 | 37 | return $this; 38 | } 39 | 40 | public function getMessageID(): string 41 | { 42 | return $this->MessageID; 43 | } 44 | 45 | public function setMessageID(string $MessageID): PostmarkOpen 46 | { 47 | $this->MessageID = $MessageID; 48 | 49 | return $this; 50 | } 51 | 52 | public function getUserAgent(): string 53 | { 54 | return $this->UserAgent; 55 | } 56 | 57 | public function setUserAgent(string $UserAgent): PostmarkOpen 58 | { 59 | $this->UserAgent = $UserAgent; 60 | 61 | return $this; 62 | } 63 | 64 | public function getGeo(): PostmarkGeographyInfo 65 | { 66 | return $this->Geo; 67 | } 68 | 69 | public function setGeo(mixed $Geo): PostmarkOpen 70 | { 71 | if (is_object($Geo)) { 72 | $Geo = new PostmarkGeographyInfo((array) $Geo); 73 | } 74 | $this->Geo = $Geo; 75 | 76 | return $this; 77 | } 78 | 79 | public function getPlatform(): string 80 | { 81 | return $this->Platform; 82 | } 83 | 84 | public function setPlatform(string $Platform): PostmarkOpen 85 | { 86 | $this->Platform = $Platform; 87 | 88 | return $this; 89 | } 90 | 91 | public function getReadSeconds(): int 92 | { 93 | return $this->ReadSeconds; 94 | } 95 | 96 | public function setReadSeconds(int $ReadSeconds): PostmarkOpen 97 | { 98 | $this->ReadSeconds = $ReadSeconds; 99 | 100 | return $this; 101 | } 102 | 103 | public function getClient(): PostmarkAgentInfo 104 | { 105 | return $this->Client; 106 | } 107 | 108 | public function setClient(mixed $Client): PostmarkOpen 109 | { 110 | if (is_object($Client)) { 111 | $Client = new PostmarkAgentInfo((array) $Client); 112 | } 113 | $this->Client = $Client; 114 | 115 | return $this; 116 | } 117 | 118 | public function getOS(): PostmarkAgentInfo 119 | { 120 | return $this->OS; 121 | } 122 | 123 | public function setOS(mixed $OS): PostmarkOpen 124 | { 125 | if (is_object($OS)) { 126 | $OS = new PostmarkAgentInfo((array) $OS); 127 | } 128 | $this->OS = $OS; 129 | 130 | return $this; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkOpenList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempOpens = []; 14 | foreach ($values['Opens'] as $open) { 15 | $obj = json_decode(json_encode($open)); 16 | $postmarkOpen = new PostmarkOpen((array) $obj); 17 | 18 | $tempOpens[] = $postmarkOpen; 19 | } 20 | $this->Opens = $tempOpens; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkOpenList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getOpens(): array 42 | { 43 | return $this->Opens; 44 | } 45 | 46 | public function setOpens(array $Opens): PostmarkOpenList 47 | { 48 | $this->Opens = $Opens; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkOutboundMessage.php: -------------------------------------------------------------------------------- 1 | Tag = !empty($values['Tag']) ? $values['Tag'] : ''; 23 | $this->MessageID = !empty($values['MessageID']) ? $values['MessageID'] : ''; 24 | $this->To = !empty($values['To']) ? $values['To'] : []; 25 | $this->Cc = !empty($values['Cc']) ? $values['Cc'] : []; 26 | $this->Bcc = !empty($values['Bcc']) ? $values['Bcc'] : []; 27 | $this->Recipients = !empty($values['Recipients']) ? $values['Recipients'] : []; 28 | $this->ReceivedAt = !empty($values['ReceivedAt']) ? $values['ReceivedAt'] : ''; 29 | $this->From = !empty($values['From']) ? $values['From'] : ''; 30 | $this->Subject = !empty($values['Subject']) ? $values['Subject'] : ''; 31 | $this->Attachments = !empty($values['Attachments']) ? $values['Attachments'] : []; 32 | $this->Status = !empty($values['Status']) ? $values['Status'] : ''; 33 | !empty($values['Metadata']) ? $this->setMetadata($values['Metadata']) : $this->setMetadata([]); 34 | } 35 | 36 | public function getTag(): string 37 | { 38 | return $this->Tag; 39 | } 40 | 41 | public function setTag(string $Tag): PostmarkOutboundMessage 42 | { 43 | $this->Tag = $Tag; 44 | 45 | return $this; 46 | } 47 | 48 | public function getMessageID(): string 49 | { 50 | return $this->MessageID; 51 | } 52 | 53 | public function setMessageID(string $MessageID): PostmarkOutboundMessage 54 | { 55 | $this->MessageID = $MessageID; 56 | 57 | return $this; 58 | } 59 | 60 | public function getTo(): array 61 | { 62 | return $this->To; 63 | } 64 | 65 | public function setTo(array $To): PostmarkOutboundMessage 66 | { 67 | $this->To = $To; 68 | 69 | return $this; 70 | } 71 | 72 | public function getCc(): array 73 | { 74 | return $this->Cc; 75 | } 76 | 77 | public function setCc(array $Cc): PostmarkOutboundMessage 78 | { 79 | $this->Cc = $Cc; 80 | 81 | return $this; 82 | } 83 | 84 | public function getBcc(): array 85 | { 86 | return $this->Bcc; 87 | } 88 | 89 | public function setBcc(array $Bcc): PostmarkOutboundMessage 90 | { 91 | $this->Bcc = $Bcc; 92 | 93 | return $this; 94 | } 95 | 96 | public function getRecipients(): array 97 | { 98 | return $this->Recipients; 99 | } 100 | 101 | public function setRecipients(array $Recipients): PostmarkOutboundMessage 102 | { 103 | $this->Recipients = $Recipients; 104 | 105 | return $this; 106 | } 107 | 108 | public function getReceivedAt(): string 109 | { 110 | return $this->ReceivedAt; 111 | } 112 | 113 | public function setReceivedAt(string $ReceivedAt): PostmarkOutboundMessage 114 | { 115 | $this->ReceivedAt = $ReceivedAt; 116 | 117 | return $this; 118 | } 119 | 120 | public function getFrom(): string 121 | { 122 | return $this->From; 123 | } 124 | 125 | public function setFrom(string $From): PostmarkOutboundMessage 126 | { 127 | $this->From = $From; 128 | 129 | return $this; 130 | } 131 | 132 | public function getSubject(): string 133 | { 134 | return $this->Subject; 135 | } 136 | 137 | public function setSubject(string $Subject): PostmarkOutboundMessage 138 | { 139 | $this->Subject = $Subject; 140 | 141 | return $this; 142 | } 143 | 144 | public function getAttachments(): array 145 | { 146 | return $this->Attachments; 147 | } 148 | 149 | public function setAttachments(array $Attachments): PostmarkOutboundMessage 150 | { 151 | $this->Attachments = $Attachments; 152 | 153 | return $this; 154 | } 155 | 156 | public function getStatus(): string 157 | { 158 | return $this->Status; 159 | } 160 | 161 | public function setStatus(string $Status): PostmarkOutboundMessage 162 | { 163 | $this->Status = $Status; 164 | 165 | return $this; 166 | } 167 | 168 | public function getMetadata(): array 169 | { 170 | return $this->Metadata; 171 | } 172 | 173 | public function setMetadata(mixed $Metadata): PostmarkOutboundMessage 174 | { 175 | if (is_object($Metadata)) { 176 | $this->Metadata = (array) $Metadata; 177 | } else { 178 | $this->Metadata = $Metadata; 179 | } 180 | 181 | return $this; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkOutboundMessageDetail.php: -------------------------------------------------------------------------------- 1 | TextBody = !empty($values['TextBody']) ? $values['TextBody'] : ''; 15 | $this->HtmlBody = !empty($values['HtmlBody']) ? $values['HtmlBody'] : ''; 16 | $this->Body = !empty($values['Body']) ? $values['Body'] : ''; 17 | $this->MessageEvents = !empty($values['MessageEvents']) ? new PostmarkMessageEvents($values) : new PostmarkMessageEvents(); 18 | 19 | parent::__construct($values); 20 | } 21 | 22 | public function getTextBody(): string 23 | { 24 | return $this->TextBody; 25 | } 26 | 27 | public function setTextBody(string $TextBody): PostmarkOutboundMessageDetail 28 | { 29 | $this->TextBody = $TextBody; 30 | 31 | return $this; 32 | } 33 | 34 | public function getHtmlBody(): string 35 | { 36 | return $this->HtmlBody; 37 | } 38 | 39 | public function setHtmlBody(string $HtmlBody): PostmarkOutboundMessageDetail 40 | { 41 | $this->HtmlBody = $HtmlBody; 42 | 43 | return $this; 44 | } 45 | 46 | public function getBody(): string 47 | { 48 | return $this->Body; 49 | } 50 | 51 | public function setBody(string $Body): PostmarkOutboundMessageDetail 52 | { 53 | $this->Body = $Body; 54 | 55 | return $this; 56 | } 57 | 58 | public function getMessageEvents(): PostmarkMessageEvents 59 | { 60 | return $this->MessageEvents; 61 | } 62 | 63 | public function setMessageEvents(PostmarkMessageEvents $MessageEvents): PostmarkOutboundMessageDetail 64 | { 65 | $this->MessageEvents = $MessageEvents; 66 | 67 | return $this; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkOutboundMessageList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempMessages = []; 14 | foreach ($values['Messages'] as $message) { 15 | $obj = json_decode(json_encode($message)); 16 | $postmarkMessage = new PostmarkOutboundMessage((array) $obj); 17 | 18 | $tempMessages[] = $postmarkMessage; 19 | } 20 | $this->Messages = $tempMessages; 21 | } 22 | 23 | /** 24 | * @return int 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkOutboundMessageList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getMessages(): array 42 | { 43 | return $this->Messages; 44 | } 45 | 46 | public function setMessages(array $Messages): PostmarkOutboundMessageList 47 | { 48 | $this->Messages = $Messages; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkResponse.php: -------------------------------------------------------------------------------- 1 | MessageID = !empty($values['MessageID']) ? $values['MessageID'] : ''; 17 | $this->PostmarkStatus = !empty($values['PostmarkStatus']) ? $values['PostmarkStatus'] : ''; 18 | $this->Message = !empty($values['Message']) ? $values['Message'] : ''; 19 | $this->SubmittedAt = !empty($values['SubmittedAt']) ? $values['SubmittedAt'] : ''; 20 | $this->To = !empty($values['To']) ? $values['To'] : ''; 21 | $this->ErrorCode = !empty($values['ErrorCode']) ? $values['ErrorCode'] : 0; 22 | } 23 | 24 | public function getMessageID(): string 25 | { 26 | return $this->MessageID; 27 | } 28 | 29 | public function setMessageID(string $MessageID): PostmarkResponse 30 | { 31 | $this->MessageID = $MessageID; 32 | 33 | return $this; 34 | } 35 | 36 | public function getPostmarkStatus(): string 37 | { 38 | return $this->PostmarkStatus; 39 | } 40 | 41 | public function setPostmarkStatus(string $PostmarkStatus): PostmarkResponse 42 | { 43 | $this->PostmarkStatus = $PostmarkStatus; 44 | 45 | return $this; 46 | } 47 | 48 | /** 49 | * @return null|mixed|string 50 | */ 51 | public function getMessage(): mixed 52 | { 53 | return $this->Message; 54 | } 55 | 56 | /** 57 | * @param null|mixed|string $Message 58 | */ 59 | public function setMessage(mixed $Message): PostmarkResponse 60 | { 61 | $this->Message = $Message; 62 | 63 | return $this; 64 | } 65 | 66 | public function getSubmittedAt(): string 67 | { 68 | return $this->SubmittedAt; 69 | } 70 | 71 | public function setSubmittedAt(string $SubmittedAt): PostmarkResponse 72 | { 73 | $this->SubmittedAt = $SubmittedAt; 74 | 75 | return $this; 76 | } 77 | 78 | public function getTo(): string 79 | { 80 | return $this->To; 81 | } 82 | 83 | public function setTo(string $To): PostmarkResponse 84 | { 85 | $this->To = $To; 86 | 87 | return $this; 88 | } 89 | 90 | /** 91 | * @return int|mixed 92 | */ 93 | public function getErrorCode(): mixed 94 | { 95 | return $this->ErrorCode; 96 | } 97 | 98 | /** 99 | * @param int|mixed $ErrorCode 100 | */ 101 | public function setErrorCode(mixed $ErrorCode): PostmarkResponse 102 | { 103 | $this->ErrorCode = $ErrorCode; 104 | 105 | return $this; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkSenderSignatureList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempSigs = []; 14 | foreach ($values['SenderSignatures'] as $open) { 15 | $obj = json_decode(json_encode($open)); 16 | $postmarkSenderSig = new PostmarkSenderSignature((array) $obj); 17 | 18 | $tempSigs[] = $postmarkSenderSig; 19 | } 20 | $this->SenderSignatures = $tempSigs; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkSenderSignatureList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getSenderSignatures(): array 42 | { 43 | return $this->SenderSignatures; 44 | } 45 | 46 | public function setSenderSignatures(array $SenderSignatures): PostmarkSenderSignatureList 47 | { 48 | $this->SenderSignatures = $SenderSignatures; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkServerList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempServers = []; 14 | foreach ($values['Servers'] as $server) { 15 | $obj = json_decode(json_encode($server)); 16 | $postmarkServer = new PostmarkServer((array) $obj); 17 | 18 | $tempServers[] = $postmarkServer; 19 | } 20 | $this->Servers = $tempServers; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkServerList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getServers(): array 42 | { 43 | return $this->Servers; 44 | } 45 | 46 | public function setServers(array $Servers): PostmarkServerList 47 | { 48 | $this->Servers = $Servers; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkTemplate.php: -------------------------------------------------------------------------------- 1 | TemplateId = !empty($values['TemplateId']) ? $values['TemplateId'] : 0; 21 | $this->Alias = !empty($values['Alias']) ? $values['Alias'] : ''; 22 | $this->Subject = !empty($values['Subject']) ? $values['Subject'] : ''; 23 | $this->Name = !empty($values['Name']) ? $values['Name'] : ''; 24 | $this->HtmlBody = !empty($values['HtmlBody']) ? $values['HtmlBody'] : ''; 25 | $this->TextBody = !empty($values['TextBody']) ? $values['TextBody'] : ''; 26 | $this->AssociatedServerId = !empty($values['AssociatedServerId']) ? $values['AssociatedServerId'] : 0; 27 | $this->Active = !empty($values['Active']) ? $values['Active'] : false; 28 | $this->TemplateType = !empty($values['TemplateType']) ? $values['TemplateType'] : 'Standard'; 29 | $this->LayoutTemplate = !empty($values['LayoutTemplate']) ? $values['LayoutTemplate'] : null; 30 | } 31 | 32 | public function getTemplateId(): int 33 | { 34 | return $this->TemplateId; 35 | } 36 | 37 | public function setTemplateId(int $id): PostmarkTemplate 38 | { 39 | $this->TemplateId = $id; 40 | 41 | return $this; 42 | } 43 | 44 | public function getAlias(): string 45 | { 46 | return $this->Alias; 47 | } 48 | 49 | public function setAlias(string $Alias): PostmarkTemplate 50 | { 51 | $this->Alias = $Alias; 52 | 53 | return $this; 54 | } 55 | 56 | public function getSubject(): string 57 | { 58 | return $this->Subject; 59 | } 60 | 61 | public function setSubject(string $Subject): PostmarkTemplate 62 | { 63 | $this->Subject = $Subject; 64 | 65 | return $this; 66 | } 67 | 68 | public function getName(): string 69 | { 70 | return $this->Name; 71 | } 72 | 73 | public function setName(string $Name): PostmarkTemplate 74 | { 75 | $this->Name = $Name; 76 | 77 | return $this; 78 | } 79 | 80 | public function getHtmlBody(): string 81 | { 82 | return $this->HtmlBody; 83 | } 84 | 85 | public function setHtmlBody(string $HtmlBody): PostmarkTemplate 86 | { 87 | $this->HtmlBody = $HtmlBody; 88 | 89 | return $this; 90 | } 91 | 92 | public function getTextBody(): string 93 | { 94 | return $this->TextBody; 95 | } 96 | 97 | public function setTextBody(string $TextBody): PostmarkTemplate 98 | { 99 | $this->TextBody = $TextBody; 100 | 101 | return $this; 102 | } 103 | 104 | public function getAssociatedServerId(): int 105 | { 106 | return $this->AssociatedServerId; 107 | } 108 | 109 | public function setAssociatedServerId(int $AssociatedServerId): PostmarkTemplate 110 | { 111 | $this->AssociatedServerId = $AssociatedServerId; 112 | 113 | return $this; 114 | } 115 | 116 | public function isActive(): bool 117 | { 118 | return $this->Active; 119 | } 120 | 121 | public function setActive(bool $Active): PostmarkTemplate 122 | { 123 | $this->Active = $Active; 124 | 125 | return $this; 126 | } 127 | 128 | public function getTemplateType(): string 129 | { 130 | return $this->TemplateType; 131 | } 132 | 133 | public function setTemplateType(string $TemplateType): PostmarkTemplate 134 | { 135 | $this->TemplateType = $TemplateType; 136 | 137 | return $this; 138 | } 139 | 140 | /** 141 | * @return ?string 142 | */ 143 | public function getLayoutTemplate(): ?string 144 | { 145 | return $this->LayoutTemplate; 146 | } 147 | 148 | public function setLayoutTemplate(string $LayoutTemplate): PostmarkTemplate 149 | { 150 | $this->LayoutTemplate = $LayoutTemplate; 151 | 152 | return $this; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/Postmark/Models/PostmarkTemplateList.php: -------------------------------------------------------------------------------- 1 | TotalCount = !empty($values['TotalCount']) ? $values['TotalCount'] : 0; 13 | $tempTemplates = []; 14 | foreach ($values['Templates'] as $template) { 15 | $obj = json_decode(json_encode($template)); 16 | $postmarkTemplate = new PostmarkTemplate((array) $obj); 17 | 18 | $tempTemplates[] = $postmarkTemplate; 19 | } 20 | $this->Templates = $tempTemplates; 21 | } 22 | 23 | /** 24 | * @return int|mixed 25 | */ 26 | public function getTotalCount(): mixed 27 | { 28 | return $this->TotalCount; 29 | } 30 | 31 | /** 32 | * @param int|mixed $TotalCount 33 | */ 34 | public function setTotalCount(mixed $TotalCount): PostmarkTemplateList 35 | { 36 | $this->TotalCount = $TotalCount; 37 | 38 | return $this; 39 | } 40 | 41 | public function getTemplates(): array 42 | { 43 | return $this->Templates; 44 | } 45 | 46 | public function setTemplates(array $Templates): PostmarkTemplateList 47 | { 48 | $this->Templates = $Templates; 49 | 50 | return $this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundBounceStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 16 | $this->HardBounce = !empty($values['HardBounce']) ? $values['HardBounce'] : 0; 17 | $this->SMTPApiError = !empty($values['SMTPApiError']) ? $values['SMTPApiError'] : 0; 18 | $this->SoftBounce = !empty($values['SoftBounce']) ? $values['SoftBounce'] : 0; 19 | $this->Transient = !empty($values['Transient']) ? $values['Transient'] : 0; 20 | } 21 | 22 | public function getDays(): array 23 | { 24 | return $this->Days; 25 | } 26 | 27 | public function setDays(array $datedBounceCount): PostmarkOutboundBounceStats 28 | { 29 | $tempArray = []; 30 | foreach ($datedBounceCount as $value) { 31 | $temp = new DatedBounceCount($value); 32 | $tempArray[] = $temp; 33 | } 34 | $this->Days = $tempArray; 35 | 36 | return $this; 37 | } 38 | 39 | public function getHardBounce(): int 40 | { 41 | return $this->HardBounce; 42 | } 43 | 44 | public function setHardBounce(int $HardBounce): PostmarkOutboundBounceStats 45 | { 46 | $this->HardBounce = $HardBounce; 47 | 48 | return $this; 49 | } 50 | 51 | public function getSMTPApiError(): int 52 | { 53 | return $this->SMTPApiError; 54 | } 55 | 56 | public function setSMTPApiError(int $SMTPApiError): PostmarkOutboundBounceStats 57 | { 58 | $this->SMTPApiError = $SMTPApiError; 59 | 60 | return $this; 61 | } 62 | 63 | public function getSoftBounce(): int 64 | { 65 | return $this->SoftBounce; 66 | } 67 | 68 | public function setSoftBounce(int $SoftBounce): PostmarkOutboundBounceStats 69 | { 70 | $this->SoftBounce = $SoftBounce; 71 | 72 | return $this; 73 | } 74 | 75 | public function getTransient(): int 76 | { 77 | return $this->Transient; 78 | } 79 | 80 | public function setTransient(int $Transient): PostmarkOutboundBounceStats 81 | { 82 | $this->Transient = $Transient; 83 | 84 | return $this; 85 | } 86 | } 87 | 88 | class DatedBounceCount 89 | { 90 | public string $Date; // DatedBounceCount object 91 | public int $HardBounce; 92 | public int $SoftBounce; 93 | 94 | public function __construct(array $values) 95 | { 96 | $this->Date = !empty($values['Date']) ? $values['Date'] : ''; 97 | $this->HardBounce = !empty($values['HardBounce']) ? $values['HardBounce'] : 0; 98 | $this->SoftBounce = !empty($values['SoftBounce']) ? $values['SoftBounce'] : 0; 99 | } 100 | 101 | /** 102 | * @return string 103 | */ 104 | public function getDate(): mixed 105 | { 106 | return $this->Date; 107 | } 108 | 109 | public function setDate(string $Date): DatedBounceCount 110 | { 111 | $this->Date = $Date; 112 | 113 | return $this; 114 | } 115 | 116 | public function getHardBounce(): int 117 | { 118 | return $this->HardBounce; 119 | } 120 | 121 | public function setHardBounce(int $HardBounce): DatedBounceCount 122 | { 123 | $this->HardBounce = $HardBounce; 124 | 125 | return $this; 126 | } 127 | 128 | public function getSoftBounce(): int 129 | { 130 | return $this->SoftBounce; 131 | } 132 | 133 | public function setSoftBounce(int $SoftBounce): DatedBounceCount 134 | { 135 | $this->SoftBounce = $SoftBounce; 136 | 137 | return $this; 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundClickStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 14 | $this->Clicks = !empty($values['Clicks']) ? $values['Clicks'] : 0; 15 | $this->Unique = !empty($values['Unique']) ? $values['Unique'] : 0; 16 | } 17 | 18 | public function getDays(): array 19 | { 20 | return $this->Days; 21 | } 22 | 23 | public function setDays(array $days): PostmarkOutboundClickStats 24 | { 25 | $tempArray = []; 26 | foreach ($days as $value) { 27 | $temp = new DatedClickCount($value); 28 | $tempArray[] = $temp; 29 | } 30 | $this->Days = $tempArray; 31 | 32 | return $this; 33 | } 34 | 35 | public function getClicks(): int 36 | { 37 | return $this->Clicks; 38 | } 39 | 40 | public function setClicks(int $Clicks): PostmarkOutboundClickStats 41 | { 42 | $this->Clicks = $Clicks; 43 | 44 | return $this; 45 | } 46 | 47 | public function getUnique(): int 48 | { 49 | return $this->Unique; 50 | } 51 | 52 | public function setUnique(int $Unique): PostmarkOutboundClickStats 53 | { 54 | $this->Unique = $Unique; 55 | 56 | return $this; 57 | } 58 | } 59 | 60 | class DatedClickCount 61 | { 62 | public string $Date; 63 | public int $Clicks; 64 | public int $Unique; 65 | 66 | public function __construct(array $values) 67 | { 68 | $this->Date = !empty($values['Date']) ? $values['Date'] : ''; 69 | $this->Clicks = !empty($values['Clicks']) ? $values['Clicks'] : 0; 70 | $this->Unique = !empty($values['Unique']) ? $values['Unique'] : 0; 71 | } 72 | 73 | public function getDate(): string 74 | { 75 | return $this->Date; 76 | } 77 | 78 | public function setDate(string $Date): DatedClickCount 79 | { 80 | $this->Date = $Date; 81 | 82 | return $this; 83 | } 84 | 85 | public function getClicks(): int 86 | { 87 | return $this->Clicks; 88 | } 89 | 90 | public function setClicks(int $Clicks): DatedClickCount 91 | { 92 | $this->Clicks = $Clicks; 93 | 94 | return $this; 95 | } 96 | 97 | public function getUnique(): int 98 | { 99 | return $this->Unique; 100 | } 101 | 102 | public function setUnique(int $Unique): DatedClickCount 103 | { 104 | $this->Unique = $Unique; 105 | 106 | return $this; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundLocationStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 14 | $this->Opens = !empty($values['Opens']) ? $values['Opens'] : 0; 15 | $this->Unique = !empty($values['Unique']) ? $values['Unique'] : 0; 16 | } 17 | 18 | public function getDays(): array 19 | { 20 | return $this->Days; 21 | } 22 | 23 | public function setDays(array $Days): PostmarkOutboundOpenStats 24 | { 25 | $tempArray = []; 26 | foreach ($Days as $value) { 27 | $temp = new DatedOpenCount($value); 28 | $tempArray[] = $temp; 29 | } 30 | $this->Days = $tempArray; 31 | 32 | return $this; 33 | } 34 | 35 | public function getOpens(): int 36 | { 37 | return $this->Opens; 38 | } 39 | 40 | public function setOpens(int $Opens): PostmarkOutboundOpenStats 41 | { 42 | $this->Opens = $Opens; 43 | 44 | return $this; 45 | } 46 | 47 | public function getUnique(): int 48 | { 49 | return $this->Unique; 50 | } 51 | 52 | public function setUnique(int $Unique): PostmarkOutboundOpenStats 53 | { 54 | $this->Unique = $Unique; 55 | 56 | return $this; 57 | } 58 | } 59 | 60 | class DatedOpenCount 61 | { 62 | public string $Date; 63 | public int $Opens; 64 | public int $Unique; 65 | 66 | public function __construct(array $values = []) 67 | { 68 | $this->Date = !empty($values['Date']) ? $values['Date'] : ''; 69 | $this->Opens = !empty($values['Opens']) ? $values['Opens'] : 0; 70 | $this->Unique = !empty($values['Unique']) ? $values['Unique'] : 0; 71 | } 72 | 73 | public function getDate(): string 74 | { 75 | return $this->Date; 76 | } 77 | 78 | public function setDate(string $Date): DatedOpenCount 79 | { 80 | $this->Date = $Date; 81 | 82 | return $this; 83 | } 84 | 85 | public function getOpens(): int 86 | { 87 | return $this->Opens; 88 | } 89 | 90 | public function setOpens(int $Opens): DatedOpenCount 91 | { 92 | $this->Opens = $Opens; 93 | 94 | return $this; 95 | } 96 | 97 | public function getUnique(): int 98 | { 99 | return $this->Unique; 100 | } 101 | 102 | public function setUnique(int $Unique): DatedOpenCount 103 | { 104 | $this->Unique = $Unique; 105 | 106 | return $this; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundOverviewStats.php: -------------------------------------------------------------------------------- 1 | Sent = !empty($values['Sent']) ? $values['Sent'] : 0; 28 | $this->Bounced = !empty($values['Bounced']) ? $values['Bounced'] : 0; 29 | $this->SMTPApiErrors = !empty($values['SMTPApiErrors']) ? $values['SMTPApiErrors'] : 0; 30 | $this->BounceRate = !empty($values['BounceRate']) ? $values['BounceRate'] : 0; 31 | $this->SpamComplaints = !empty($values['SpamComplaints']) ? $values['SpamComplaints'] : 0; 32 | $this->SpamComplaintsRate = !empty($values['SpamComplaintsRate']) ? $values['SpamComplaintsRate'] : 0; 33 | $this->Opens = !empty($values['Opens']) ? $values['Opens'] : 0; 34 | $this->UniqueOpens = !empty($values['UniqueOpens']) ? $values['UniqueOpens'] : 0; 35 | $this->Tracked = !empty($values['Tracked']) ? $values['Tracked'] : 0; 36 | $this->WithClientRecorded = !empty($values['WithClientRecorded']) ? $values['WithClientRecorded'] : 0; 37 | $this->WithPlatformRecorded = !empty($values['WithPlatformRecorded']) ? $values['WithPlatformRecorded'] : 0; 38 | $this->WithReadTimeRecorded = !empty($values['WithReadTimeRecorded']) ? $values['WithReadTimeRecorded'] : 0; 39 | $this->TotalClicks = !empty($values['TotalClicks']) ? $values['TotalClicks'] : 0; 40 | $this->UniqueLinksClicked = !empty($values['UniqueLinksClicked']) ? $values['UniqueLinksClicked'] : 0; 41 | $this->TotalTrackedLinksSent = !empty($values['TotalTrackedLinksSent']) ? $values['TotalTrackedLinksSent'] : 0; 42 | $this->WithLinkTracking = !empty($values['WithLinkTracking']) ? $values['WithLinkTracking'] : 0; 43 | $this->WithOpenTracking = !empty($values['WithOpenTracking']) ? $values['WithOpenTracking'] : 0; 44 | } 45 | 46 | public function getSent(): int 47 | { 48 | return $this->Sent; 49 | } 50 | 51 | public function setSent(int $Sent): PostmarkOutboundOverviewStats 52 | { 53 | $this->Sent = $Sent; 54 | 55 | return $this; 56 | } 57 | 58 | public function getBounced(): int 59 | { 60 | return $this->Bounced; 61 | } 62 | 63 | public function setBounced(int $Bounced): PostmarkOutboundOverviewStats 64 | { 65 | $this->Bounced = $Bounced; 66 | 67 | return $this; 68 | } 69 | 70 | public function getSMTPApiErrors(): int 71 | { 72 | return $this->SMTPApiErrors; 73 | } 74 | 75 | public function setSMTPApiErrors(int $SMTPApiErrors): PostmarkOutboundOverviewStats 76 | { 77 | $this->SMTPApiErrors = $SMTPApiErrors; 78 | 79 | return $this; 80 | } 81 | 82 | public function getBounceRate(): float 83 | { 84 | return $this->BounceRate; 85 | } 86 | 87 | public function setBounceRate(float $BounceRate): PostmarkOutboundOverviewStats 88 | { 89 | $this->BounceRate = $BounceRate; 90 | 91 | return $this; 92 | } 93 | 94 | public function getSpamComplaints(): int 95 | { 96 | return $this->SpamComplaints; 97 | } 98 | 99 | public function setSpamComplaints(int $SpamComplaints): PostmarkOutboundOverviewStats 100 | { 101 | $this->SpamComplaints = $SpamComplaints; 102 | 103 | return $this; 104 | } 105 | 106 | public function getSpamComplaintsRate(): float 107 | { 108 | return $this->SpamComplaintsRate; 109 | } 110 | 111 | public function setSpamComplaintsRate(float $SpamComplaintsRate): PostmarkOutboundOverviewStats 112 | { 113 | $this->SpamComplaintsRate = $SpamComplaintsRate; 114 | 115 | return $this; 116 | } 117 | 118 | public function getOpens(): int 119 | { 120 | return $this->Opens; 121 | } 122 | 123 | public function setOpens(int $Opens): PostmarkOutboundOverviewStats 124 | { 125 | $this->Opens = $Opens; 126 | 127 | return $this; 128 | } 129 | 130 | public function getUniqueOpens(): int 131 | { 132 | return $this->UniqueOpens; 133 | } 134 | 135 | public function setUniqueOpens(int $UniqueOpens): PostmarkOutboundOverviewStats 136 | { 137 | $this->UniqueOpens = $UniqueOpens; 138 | 139 | return $this; 140 | } 141 | 142 | public function getTracked(): int 143 | { 144 | return $this->Tracked; 145 | } 146 | 147 | public function setTracked(int $Tracked): PostmarkOutboundOverviewStats 148 | { 149 | $this->Tracked = $Tracked; 150 | 151 | return $this; 152 | } 153 | 154 | public function getWithClientRecorded(): int 155 | { 156 | return $this->WithClientRecorded; 157 | } 158 | 159 | public function setWithClientRecorded(int $WithClientRecorded): PostmarkOutboundOverviewStats 160 | { 161 | $this->WithClientRecorded = $WithClientRecorded; 162 | 163 | return $this; 164 | } 165 | 166 | public function getWithPlatformRecorded(): int 167 | { 168 | return $this->WithPlatformRecorded; 169 | } 170 | 171 | public function setWithPlatformRecorded(int $WithPlatformRecorded): PostmarkOutboundOverviewStats 172 | { 173 | $this->WithPlatformRecorded = $WithPlatformRecorded; 174 | 175 | return $this; 176 | } 177 | 178 | public function getWithReadTimeRecorded(): int 179 | { 180 | return $this->WithReadTimeRecorded; 181 | } 182 | 183 | public function setWithReadTimeRecorded(int $WithReadTimeRecorded): PostmarkOutboundOverviewStats 184 | { 185 | $this->WithReadTimeRecorded = $WithReadTimeRecorded; 186 | 187 | return $this; 188 | } 189 | 190 | public function getTotalClicks(): int 191 | { 192 | return $this->TotalClicks; 193 | } 194 | 195 | public function setTotalClicks(int $TotalClicks): PostmarkOutboundOverviewStats 196 | { 197 | $this->TotalClicks = $TotalClicks; 198 | 199 | return $this; 200 | } 201 | 202 | public function getUniqueLinksClicked(): int 203 | { 204 | return $this->UniqueLinksClicked; 205 | } 206 | 207 | public function setUniqueLinksClicked(int $UniqueLinksClicked): PostmarkOutboundOverviewStats 208 | { 209 | $this->UniqueLinksClicked = $UniqueLinksClicked; 210 | 211 | return $this; 212 | } 213 | 214 | public function getTotalTrackedLinksSent(): int 215 | { 216 | return $this->TotalTrackedLinksSent; 217 | } 218 | 219 | public function setTotalTrackedLinksSent(int $TotalTrackedLinksSent): PostmarkOutboundOverviewStats 220 | { 221 | $this->TotalTrackedLinksSent = $TotalTrackedLinksSent; 222 | 223 | return $this; 224 | } 225 | 226 | public function getWithLinkTracking(): int 227 | { 228 | return $this->WithLinkTracking; 229 | } 230 | 231 | public function setWithLinkTracking(int $WithLinkTracking): PostmarkOutboundOverviewStats 232 | { 233 | $this->WithLinkTracking = $WithLinkTracking; 234 | 235 | return $this; 236 | } 237 | 238 | public function getWithOpenTracking(): int 239 | { 240 | return $this->WithOpenTracking; 241 | } 242 | 243 | public function setWithOpenTracking(int $WithOpenTracking): PostmarkOutboundOverviewStats 244 | { 245 | $this->WithOpenTracking = $WithOpenTracking; 246 | 247 | return $this; 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundPlatformStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 16 | $this->Desktop = !empty($values['Desktop']) ? $values['Desktop'] : 0; 17 | $this->Mobile = !empty($values['Mobile']) ? $values['Mobile'] : 0; 18 | $this->Webmail = !empty($values['Webmail']) ? $values['Webmail'] : 0; 19 | $this->Unknown = !empty($values['Unknown']) ? $values['Unknown'] : 0; 20 | } 21 | 22 | public function getDays(): array 23 | { 24 | return $this->Days; 25 | } 26 | 27 | public function setDays(array $Days): PostmarkOutboundPlatformStats 28 | { 29 | $tempArray = []; 30 | foreach ($Days as $value) { 31 | $temp = new DatedPlatformCount($value); 32 | $tempArray[] = $temp; 33 | } 34 | $this->Days = $tempArray; 35 | 36 | return $this; 37 | } 38 | 39 | public function getDesktop(): int 40 | { 41 | return $this->Desktop; 42 | } 43 | 44 | public function setDesktop(int $Desktop): PostmarkOutboundPlatformStats 45 | { 46 | $this->Desktop = $Desktop; 47 | 48 | return $this; 49 | } 50 | 51 | public function getMobile(): int 52 | { 53 | return $this->Mobile; 54 | } 55 | 56 | public function setMobile(int $Mobile): PostmarkOutboundPlatformStats 57 | { 58 | $this->Mobile = $Mobile; 59 | 60 | return $this; 61 | } 62 | 63 | public function getWebmail(): int 64 | { 65 | return $this->Webmail; 66 | } 67 | 68 | public function setWebmail(int $Webmail): PostmarkOutboundPlatformStats 69 | { 70 | $this->Webmail = $Webmail; 71 | 72 | return $this; 73 | } 74 | 75 | public function getUnknown(): int 76 | { 77 | return $this->Unknown; 78 | } 79 | 80 | public function setUnknown(int $Unknown): PostmarkOutboundPlatformStats 81 | { 82 | $this->Unknown = $Unknown; 83 | 84 | return $this; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundReadStats.php: -------------------------------------------------------------------------------- 1 | Date = !empty($values['Date']) ? $values['Date'] : ''; 19 | // $this->Read = !empty($values['Read']) ? $values['Read'] : 0; 20 | // } 21 | // } 22 | // 23 | // class ReadCount 24 | // { 25 | // 26 | // } 27 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundSentStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 13 | $this->Sent = !empty($values['Sent']) ? $values['Sent'] : 0; 14 | } 15 | 16 | public function getDays(): array 17 | { 18 | return $this->Days; 19 | } 20 | 21 | public function setDays(array $datedSendCount): PostmarkOutboundSentStats 22 | { 23 | $tempArray = []; 24 | foreach ($datedSendCount as $value) { 25 | $temp = new DatedSendCount($value); 26 | $tempArray[] = $temp; 27 | } 28 | $this->Days = $tempArray; 29 | 30 | return $this; 31 | } 32 | 33 | public function getSent(): int 34 | { 35 | return $this->Sent; 36 | } 37 | 38 | public function setSent(int $Sent): PostmarkOutboundSentStats 39 | { 40 | $this->Sent = $Sent; 41 | 42 | return $this; 43 | } 44 | } 45 | 46 | class DatedSendCount 47 | { 48 | public string $Date; 49 | public int $Sent; 50 | 51 | public function __construct(array $values) 52 | { 53 | $this->Date = !empty($values['Date']) ? $values['Date'] : ''; 54 | $this->Sent = !empty($values['Sent']) ? $values['Sent'] : 0; 55 | } 56 | 57 | public function getDate(): string 58 | { 59 | return $this->Date; 60 | } 61 | 62 | public function setDate(string $Date): DatedSendCount 63 | { 64 | $this->Date = $Date; 65 | 66 | return $this; 67 | } 68 | 69 | public function getSent(): int 70 | { 71 | return $this->Sent; 72 | } 73 | 74 | public function setSent(int $Sent): DatedSendCount 75 | { 76 | $this->Sent = $Sent; 77 | 78 | return $this; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundSpamComplaintStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 16 | $this->Desktop = !empty($values['Desktop']) ? $values['Desktop'] : 0; 17 | $this->Mobile = !empty($values['Mobile']) ? $values['Mobile'] : 0; 18 | $this->Unknown = !empty($values['Unknown']) ? $values['Unknown'] : 0; 19 | $this->WebMail = !empty($values['WebMail']) ? $values['WebMail'] : 0; 20 | } 21 | 22 | public function getDays(): array 23 | { 24 | return $this->Days; 25 | } 26 | 27 | public function setDays(array $datedPlatformCount): PostmarkOutboundSpamComplaintStats 28 | { 29 | $tempArray = []; 30 | foreach ($datedPlatformCount as $value) { 31 | $temp = new DatedPlatformCount($value); 32 | $tempArray[] = $temp; 33 | } 34 | $this->Days = $tempArray; 35 | 36 | return $this; 37 | } 38 | 39 | public function getDesktop(): int 40 | { 41 | return $this->Desktop; 42 | } 43 | 44 | public function setDesktop(int $Desktop): PostmarkOutboundSpamComplaintStats 45 | { 46 | $this->Desktop = $Desktop; 47 | 48 | return $this; 49 | } 50 | 51 | public function getMobile(): int 52 | { 53 | return $this->Mobile; 54 | } 55 | 56 | public function setMobile(int $Mobile): PostmarkOutboundSpamComplaintStats 57 | { 58 | $this->Mobile = $Mobile; 59 | 60 | return $this; 61 | } 62 | 63 | public function getUnknown(): int 64 | { 65 | return $this->Unknown; 66 | } 67 | 68 | public function setUnknown(int $Unknown): PostmarkOutboundSpamComplaintStats 69 | { 70 | $this->Unknown = $Unknown; 71 | 72 | return $this; 73 | } 74 | 75 | public function getWebMail(): int 76 | { 77 | return $this->WebMail; 78 | } 79 | 80 | public function setWebMail(int $WebMail): PostmarkOutboundSpamComplaintStats 81 | { 82 | $this->WebMail = $WebMail; 83 | 84 | return $this; 85 | } 86 | } 87 | 88 | class DatedPlatformCount 89 | { 90 | public string $Date; 91 | public int $Desktop; 92 | public int $Mobile; 93 | public int $Unknown; 94 | public int $WebMail; 95 | 96 | public function __construct(array $values) 97 | { 98 | $this->Date = !empty($values['Date']) ? $values['Date'] : ''; 99 | $this->Desktop = !empty($values['Desktop']) ? $values['Desktop'] : 0; 100 | $this->Mobile = !empty($values['Mobile']) ? $values['Mobile'] : 0; 101 | $this->Unknown = !empty($values['Unknown']) ? $values['Unknown'] : 0; 102 | $this->WebMail = !empty($values['WebMail']) ? $values['WebMail'] : 0; 103 | } 104 | 105 | public function getDate(): string 106 | { 107 | return $this->Date; 108 | } 109 | 110 | public function setDate(string $Date): DatedPlatformCount 111 | { 112 | $this->Date = $Date; 113 | 114 | return $this; 115 | } 116 | 117 | public function getDesktop(): int 118 | { 119 | return $this->Desktop; 120 | } 121 | 122 | public function setDesktop(int $Desktop): DatedPlatformCount 123 | { 124 | $this->Desktop = $Desktop; 125 | 126 | return $this; 127 | } 128 | 129 | public function getMobile(): int 130 | { 131 | return $this->Mobile; 132 | } 133 | 134 | public function setMobile(int $Mobile): DatedPlatformCount 135 | { 136 | $this->Mobile = $Mobile; 137 | 138 | return $this; 139 | } 140 | 141 | public function getUnknown(): int 142 | { 143 | return $this->Unknown; 144 | } 145 | 146 | public function setUnknown(int $Unknown): DatedPlatformCount 147 | { 148 | $this->Unknown = $Unknown; 149 | 150 | return $this; 151 | } 152 | 153 | public function getWebMail(): int 154 | { 155 | return $this->WebMail; 156 | } 157 | 158 | public function setWebMail(int $WebMail): DatedPlatformCount 159 | { 160 | $this->WebMail = $WebMail; 161 | 162 | return $this; 163 | } 164 | } 165 | -------------------------------------------------------------------------------- /src/Postmark/Models/Stats/PostmarkOutboundTrackedStats.php: -------------------------------------------------------------------------------- 1 | setDays($values['Days']) : $this->setDays([]); 13 | $this->Tracked = !empty($values['Tracked']) ? $values['Tracked'] : 0; 14 | } 15 | 16 | public function getDays(): array 17 | { 18 | return $this->Days; 19 | } 20 | 21 | public function setDays(array $datedTrackedCount): PostmarkOutboundTrackedStats 22 | { 23 | $tempArray = []; 24 | foreach ($datedTrackedCount as $value) { 25 | $temp = new DatedTrackedCount($value); 26 | $tempArray[] = $temp; 27 | } 28 | $this->Days = $tempArray; 29 | 30 | return $this; 31 | } 32 | 33 | public function getTracked(): int 34 | { 35 | return $this->Tracked; 36 | } 37 | 38 | public function setTracked(int $Tracked): PostmarkOutboundTrackedStats 39 | { 40 | $this->Tracked = $Tracked; 41 | 42 | return $this; 43 | } 44 | } 45 | 46 | class DatedTrackedCount 47 | { 48 | public string $Date; 49 | public int $Tracked; 50 | 51 | public function __construct(array $values) 52 | { 53 | $this->Date = !empty($values['Date']) ? $values['Date'] : ''; 54 | $this->Tracked = !empty($values['Tracked']) ? $values['Tracked'] : 0; 55 | } 56 | 57 | public function getDate(): string 58 | { 59 | return $this->Date; 60 | } 61 | 62 | public function setDate(string $Date): DatedTrackedCount 63 | { 64 | $this->Date = $Date; 65 | 66 | return $this; 67 | } 68 | 69 | public function getTracked(): int 70 | { 71 | return $this->Tracked; 72 | } 73 | 74 | public function setTracked(int $Tracked): DatedTrackedCount 75 | { 76 | $this->Tracked = $Tracked; 77 | 78 | return $this; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Postmark/Models/Suppressions/PostmarkSuppression.php: -------------------------------------------------------------------------------- 1 | EmailAddress = !empty($values['EmailAddress']) ? $values['EmailAddress'] : ''; 15 | $this->SuppressionReason = !empty($values['SuppressionReason']) ? $values['SuppressionReason'] : ''; 16 | $this->Origin = !empty($values['Origin']) ? $values['Origin'] : ''; 17 | $this->CreatedAt = !empty($values['CreatedAt']) ? $values['CreatedAt'] : ''; 18 | } 19 | 20 | public function getEmailAddress(): string 21 | { 22 | return $this->EmailAddress; 23 | } 24 | 25 | public function setEmailAddress(string $EmailAddress): PostmarkSuppression 26 | { 27 | $this->EmailAddress = $EmailAddress; 28 | 29 | return $this; 30 | } 31 | 32 | public function getSuppressionReason(): string 33 | { 34 | return $this->SuppressionReason; 35 | } 36 | 37 | public function setSuppressionReason(string $SuppressionReason): PostmarkSuppression 38 | { 39 | $this->SuppressionReason = $SuppressionReason; 40 | 41 | return $this; 42 | } 43 | 44 | public function getOrigin(): string 45 | { 46 | return $this->Origin; 47 | } 48 | 49 | public function setOrigin(string $Origin): PostmarkSuppression 50 | { 51 | $this->Origin = $Origin; 52 | 53 | return $this; 54 | } 55 | 56 | public function getCreatedAt(): string 57 | { 58 | return $this->CreatedAt; 59 | } 60 | 61 | public function setCreatedAt(string $CreatedAt): PostmarkSuppression 62 | { 63 | $this->CreatedAt = $CreatedAt; 64 | 65 | return $this; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Postmark/Models/Suppressions/PostmarkSuppressionList.php: -------------------------------------------------------------------------------- 1 | Suppressions = $tempSuppressions; 19 | } 20 | 21 | public function getSuppressions(): array 22 | { 23 | return $this->Suppressions; 24 | } 25 | 26 | public function setSuppressions(array $Suppressions): PostmarkSuppressionList 27 | { 28 | $this->Suppressions = $Suppressions; 29 | 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Postmark/Models/Suppressions/PostmarkSuppressionRequestResult.php: -------------------------------------------------------------------------------- 1 | EmailAddress = !empty($values['EmailAddress']) ? $values['EmailAddress'] : ''; 14 | $this->Status = !empty($values['Status']) ? $values['Status'] : ''; 15 | $this->Message = !empty($values['Message']) ? $values['Message'] : ''; 16 | } 17 | 18 | public function getEmailAddress(): string 19 | { 20 | return $this->EmailAddress; 21 | } 22 | 23 | public function setEmailAddress(string $EmailAddress): PostmarkSuppressionRequestResult 24 | { 25 | $this->EmailAddress = $EmailAddress; 26 | 27 | return $this; 28 | } 29 | 30 | public function getStatus(): string 31 | { 32 | return $this->Status; 33 | } 34 | 35 | public function setStatus(string $Status): PostmarkSuppressionRequestResult 36 | { 37 | $this->Status = $Status; 38 | 39 | return $this; 40 | } 41 | 42 | public function getMessage(): string 43 | { 44 | return $this->Message; 45 | } 46 | 47 | public function setMessage(string $Message): PostmarkSuppressionRequestResult 48 | { 49 | $this->Message = $Message; 50 | 51 | return $this; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Postmark/Models/Suppressions/PostmarkSuppressionResultList.php: -------------------------------------------------------------------------------- 1 | Suppressions = $tempSuppressions; 19 | } 20 | 21 | public function getSuppressions(): array 22 | { 23 | return $this->Suppressions; 24 | } 25 | 26 | public function setSuppressions(array $Suppressions): PostmarkSuppressionResultList 27 | { 28 | $this->Suppressions = $Suppressions; 29 | 30 | return $this; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Postmark/Models/Suppressions/SuppressionChangeRequest.php: -------------------------------------------------------------------------------- 1 | EmailAddress = $emailAddress; 22 | } 23 | 24 | public function jsonSerialize(): array 25 | { 26 | return [ 27 | 'EmailAddress' => $this->EmailAddress, 28 | ]; 29 | } 30 | 31 | public function getEmailAddress(): ?string 32 | { 33 | return $this->EmailAddress; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Postmark/Models/TemplatedPostmarkMessage.php: -------------------------------------------------------------------------------- 1 | TemplateId = !empty($values['TemplateId']) ? $values['TemplateId'] : 0; 15 | $this->TemplateAlias = !empty($values['TemplateAlias']) ? $values['TemplateAlias'] : ''; 16 | $this->InlineCss = !empty($values['InlineCss']) ? $values['InlineCss'] : true; 17 | $this->TemplateModel = !empty($values['TemplateModel']) ? $values['TemplateModel'] : []; 18 | 19 | parent::__construct($values); 20 | } 21 | 22 | public function getTemplateId(): ?int 23 | { 24 | return $this->TemplateId; 25 | } 26 | 27 | public function setTemplateId(?int $TemplateId): TemplatedPostmarkMessage 28 | { 29 | $this->TemplateId = $TemplateId; 30 | 31 | return $this; 32 | } 33 | 34 | public function getTemplateAlias(): ?string 35 | { 36 | return $this->TemplateAlias; 37 | } 38 | 39 | public function setTemplateAlias(?string $TemplateAlias): TemplatedPostmarkMessage 40 | { 41 | $this->TemplateAlias = $TemplateAlias; 42 | 43 | return $this; 44 | } 45 | 46 | public function isInlineCss(): bool 47 | { 48 | return $this->InlineCss; 49 | } 50 | 51 | public function setInlineCss(bool $InlineCss): TemplatedPostmarkMessage 52 | { 53 | $this->InlineCss = $InlineCss; 54 | 55 | return $this; 56 | } 57 | 58 | public function getTemplateModel(): ?array 59 | { 60 | return $this->TemplateModel; 61 | } 62 | 63 | public function setTemplateModel(?array $TemplateModel): TemplatedPostmarkMessage 64 | { 65 | $this->TemplateModel = $TemplateModel; 66 | 67 | return $this; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/HttpAuth.php: -------------------------------------------------------------------------------- 1 | username = $username; 24 | $this->password = $password; 25 | } 26 | 27 | public function jsonSerialize(): array 28 | { 29 | return [ 30 | 'Username' => $this->username, 31 | 'Password' => $this->password, 32 | ]; 33 | } 34 | 35 | public function getUsername(): ?string 36 | { 37 | return $this->username; 38 | } 39 | 40 | public function getPassword(): ?string 41 | { 42 | return $this->password; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/HttpHeader.php: -------------------------------------------------------------------------------- 1 | HttpAuth) ? new HttpAuth($obj->HttpAuth->Username, $obj->HttpAuth->Password) : new HttpAuth(); 25 | 26 | $local_triggers = $obj->Triggers; 27 | $local_open = !empty($local_triggers->Open) ? new WebhookConfigurationOpenTrigger($local_triggers->Open->Enabled, $local_triggers->Open->PostFirstOpenOnly) : null; 28 | $local_click = !empty($local_triggers->Click) ? new WebhookConfigurationClickTrigger($local_triggers->Click->Enabled) : null; 29 | $local_delivery = !empty($local_triggers->Delivery) ? new WebhookConfigurationDeliveryTrigger($local_triggers->Delivery->Enabled) : null; 30 | $local_bounce = !empty($local_triggers->Bounce) ? new WebhookConfigurationBounceTrigger($local_triggers->Bounce->Enabled, $local_triggers->Bounce->IncludeContent) : null; 31 | $local_spamComplaint = !empty($local_triggers->SpamComplaint) ? new WebhookConfigurationSpamComplaintTrigger($local_triggers->SpamComplaint->Enabled, $local_triggers->SpamComplaint->IncludeContent) : null; 32 | $local_subscriptionChange = !empty($local_triggers->SubscriptionChange) ? new WebhookConfigurationSubscriptionChangeTrigger($local_triggers->SubscriptionChange->Enabled) : null; 33 | 34 | $triggers = new WebhookConfigurationTriggers( 35 | $local_open, 36 | $local_click, 37 | $local_delivery, 38 | $local_bounce, 39 | $local_spamComplaint, 40 | $local_subscriptionChange 41 | ); 42 | 43 | $local_id = !empty($obj->ID) ? $obj->ID : 0; 44 | $local_url = !empty($obj->Url) ? $obj->Url : ''; 45 | $local_message = !empty($obj->MessageStream) ? $obj->MessageStream : ''; 46 | $local_httpauth = $httpAuth; 47 | $local_httpheaders = !empty($obj->HttpHeaders) ? $obj->HttpHeaders : []; 48 | $local_triggers = $triggers; 49 | 50 | $this->Build($local_id, $local_url, $local_message, $local_httpauth, $local_httpheaders, $local_triggers); 51 | } else { 52 | $this->Build($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4], $arguments[5]); 53 | } 54 | } 55 | 56 | public function Build( 57 | int $ID = 0, 58 | string $Url = null, 59 | string $MessageStream = null, 60 | ?HttpAuth $HttpAuth = null, 61 | array $HttpHeaders = [], 62 | WebhookConfigurationTriggers $Triggers = null 63 | ) { 64 | $this->ID = $ID; 65 | $this->Url = $Url; 66 | $this->MessageStream = $MessageStream; 67 | $this->HttpAuth = $HttpAuth; 68 | $this->HttpHeaders = $HttpHeaders; 69 | $this->Triggers = $Triggers; 70 | } 71 | 72 | public function jsonSerialize(): array 73 | { 74 | return [ 75 | 'ID' => $this->ID, 76 | 'Url' => $this->Url, 77 | 'MessageStream' => $this->MessageStream, 78 | 'HttpAuth' => $this->HttpAuth, 79 | 'HttpHeaders' => $this->HttpHeaders, 80 | ]; 81 | } 82 | 83 | public function getID(): int 84 | { 85 | return $this->ID; 86 | } 87 | 88 | public function setID(int $ID): WebhookConfiguration 89 | { 90 | $this->ID = $ID; 91 | 92 | return $this; 93 | } 94 | 95 | public function getUrl(): string 96 | { 97 | return $this->Url; 98 | } 99 | 100 | public function setUrl(string $Url): WebhookConfiguration 101 | { 102 | $this->Url = $Url; 103 | 104 | return $this; 105 | } 106 | 107 | public function getMessageStream(): string 108 | { 109 | return $this->MessageStream; 110 | } 111 | 112 | public function setMessageStream(string $MessageStream): WebhookConfiguration 113 | { 114 | $this->MessageStream = $MessageStream; 115 | 116 | return $this; 117 | } 118 | 119 | public function getHttpAuth(): HttpAuth 120 | { 121 | return $this->HttpAuth; 122 | } 123 | 124 | public function setHttpAuth(HttpAuth $HttpAuth): WebhookConfiguration 125 | { 126 | $this->HttpAuth = $HttpAuth; 127 | 128 | return $this; 129 | } 130 | 131 | public function getHttpHeaders(): array 132 | { 133 | return $this->HttpHeaders; 134 | } 135 | 136 | public function setHttpHeaders(array $HttpHeaders): WebhookConfiguration 137 | { 138 | $this->HttpHeaders = $HttpHeaders; 139 | 140 | return $this; 141 | } 142 | 143 | public function getTriggers(): WebhookConfigurationTriggers 144 | { 145 | return $this->Triggers; 146 | } 147 | 148 | public function setTriggers(WebhookConfigurationTriggers $Triggers): WebhookConfiguration 149 | { 150 | $this->Triggers = $Triggers; 151 | 152 | return $this; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationBounceTrigger.php: -------------------------------------------------------------------------------- 1 | Enabled = $enabled; 21 | $this->IncludeContent = $includeContent; 22 | } 23 | 24 | public function jsonSerialize(): array 25 | { 26 | return [ 27 | 'Enabled' => $this->Enabled, 28 | 'IncludeContent' => $this->IncludeContent, 29 | ]; 30 | } 31 | 32 | public function getEnabled(): bool 33 | { 34 | return $this->Enabled; 35 | } 36 | 37 | public function getIncludeContent(): bool 38 | { 39 | return $this->IncludeContent; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationClickTrigger.php: -------------------------------------------------------------------------------- 1 | enabled = $enabled; 22 | } 23 | 24 | public function jsonSerialize(): array 25 | { 26 | return [ 27 | 'Enabled' => $this->enabled, 28 | ]; 29 | } 30 | 31 | public function getEnabled(): bool 32 | { 33 | return $this->enabled; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationDeliveryTrigger.php: -------------------------------------------------------------------------------- 1 | enabled = $enabled; 22 | } 23 | 24 | public function jsonSerialize(): array 25 | { 26 | return [ 27 | 'Enabled' => $this->enabled, 28 | ]; 29 | } 30 | 31 | public function getEnabled(): bool 32 | { 33 | return $this->enabled; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationListingResponse.php: -------------------------------------------------------------------------------- 1 | Webhooks = []; 12 | $this->setWebhooks($webhooks); 13 | } 14 | 15 | public function getWebhooks(): array 16 | { 17 | return $this->Webhooks; 18 | } 19 | 20 | public function setWebhooks(array $Webhooks): WebhookConfigurationListingResponse 21 | { 22 | $tempHooks = []; 23 | foreach ($Webhooks['Webhooks'] as $webhook) { 24 | $obj = json_decode(json_encode($webhook)); 25 | $triggers = new WebhookConfigurationTriggers(); 26 | $httpAuth = new HttpAuth(); 27 | $webhookConfig = new WebhookConfiguration((int) $obj->ID, $obj->Url, $obj->MessageStream, $httpAuth, [], $triggers); 28 | 29 | $tempHooks[] = $webhookConfig; 30 | } 31 | $this->Webhooks = $tempHooks; 32 | 33 | return $this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationOpenTrigger.php: -------------------------------------------------------------------------------- 1 | Enabled = $enabled; 24 | $this->PostFirstOpenOnly = $postFirstOpenOnly; 25 | } 26 | 27 | public function jsonSerialize(): array 28 | { 29 | return [ 30 | 'Enabled' => $this->Enabled, 31 | 'PostFirstOpenOnly' => $this->PostFirstOpenOnly, 32 | ]; 33 | } 34 | 35 | public function getEnabled(): bool 36 | { 37 | return $this->Enabled; 38 | } 39 | 40 | public function getPostFirstOpenOnly(): bool 41 | { 42 | return $this->PostFirstOpenOnly; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationSpamComplaintTrigger.php: -------------------------------------------------------------------------------- 1 | Enabled = $enabled; 24 | $this->IncludeContent = $includeContent; 25 | } 26 | 27 | public function jsonSerialize(): array 28 | { 29 | return [ 30 | 'Enabled' => $this->Enabled, 31 | 'IncludeContent' => $this->IncludeContent, 32 | ]; 33 | } 34 | 35 | public function getEnabled(): bool 36 | { 37 | return $this->Enabled; 38 | } 39 | 40 | public function getIncludeContent(): bool 41 | { 42 | return $this->IncludeContent; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationSubscriptionChangeTrigger.php: -------------------------------------------------------------------------------- 1 | Enabled = $enabled; 22 | } 23 | 24 | public function jsonSerialize(): array 25 | { 26 | return [ 27 | 'Enabled' => $this->Enabled, 28 | ]; 29 | } 30 | 31 | public function getEnabled(): bool 32 | { 33 | return $this->Enabled; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Postmark/Models/Webhooks/WebhookConfigurationTriggers.php: -------------------------------------------------------------------------------- 1 | Open = $open; 38 | $this->Click = $click; 39 | $this->Delivery = $delivery; 40 | $this->Bounce = $bounce; 41 | $this->SpamComplaint = $spamComplaint; 42 | $this->SubscriptionChange = $subscriptionChange; 43 | } 44 | 45 | public function jsonSerialize(): array 46 | { 47 | $returnValue = []; 48 | 49 | if (null !== $this->Open) { 50 | $returnValue['Open'] = $this->Open->jsonSerialize(); 51 | } 52 | 53 | if (null !== $this->Click) { 54 | $returnValue['Click'] = $this->Click->jsonSerialize(); 55 | } 56 | 57 | if (null !== $this->Delivery) { 58 | $returnValue['Delivery'] = $this->Delivery->jsonSerialize(); 59 | } 60 | 61 | if (null !== $this->Bounce) { 62 | $returnValue['Bounce'] = $this->Bounce->jsonSerialize(); 63 | } 64 | 65 | if (null !== $this->SpamComplaint) { 66 | $returnValue['SpamComplaint'] = $this->SpamComplaint->jsonSerialize(); 67 | } 68 | 69 | if (null !== $this->SubscriptionChange) { 70 | $returnValue['SubscriptionChange'] = $this->SubscriptionChange->jsonSerialize(); 71 | } 72 | 73 | return $returnValue; 74 | } 75 | 76 | public function getOpenSettings(): ?WebhookConfigurationOpenTrigger 77 | { 78 | return $this->Open; 79 | } 80 | 81 | public function getClickSettings(): ?WebhookConfigurationClickTrigger 82 | { 83 | return $this->Click; 84 | } 85 | 86 | public function getDeliverySettings(): ?WebhookConfigurationDeliveryTrigger 87 | { 88 | return $this->Delivery; 89 | } 90 | 91 | public function getBounceSettings(): ?WebhookConfigurationBounceTrigger 92 | { 93 | return $this->Bounce; 94 | } 95 | 96 | public function getSpamComplaintSettings(): ?WebhookConfigurationSpamComplaintTrigger 97 | { 98 | return $this->SpamComplaint; 99 | } 100 | 101 | public function getSubscriptionChangeSettings(): ?WebhookConfigurationSubscriptionChangeTrigger 102 | { 103 | return $this->SubscriptionChange; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/Postmark/PostmarkClientBase.php: -------------------------------------------------------------------------------- 1 | authorization_header = $header; 57 | $this->authorization_token = $token; 58 | $this->version = phpversion(); 59 | $this->os = PHP_OS; 60 | $this->timeout = $timeout; 61 | } 62 | 63 | /** 64 | * Provide a custom GuzzleHttp\Client to be used for HTTP requests. 65 | * 66 | * @see http://docs.guzzlephp.org/en/latest/ for a full list of configuration options 67 | * 68 | * The following options will be ignored: 69 | * - http_errors 70 | * - headers 71 | * - query 72 | * - json 73 | */ 74 | public function setClient(Client $client) 75 | { 76 | $this->client = $client; 77 | } 78 | 79 | /** 80 | * Return the injected GuzzleHttp\Client or create a default instance. 81 | * 82 | * @return Client 83 | */ 84 | protected function getClient() 85 | { 86 | if (empty($this->client)) { 87 | $this->client = new Client([ 88 | RequestOptions::VERIFY => self::$VERIFY_SSL, 89 | RequestOptions::TIMEOUT => $this->timeout, 90 | ]); 91 | } 92 | 93 | return $this->client; 94 | } 95 | 96 | /** 97 | * The base request method for all API access. 98 | * 99 | * @param string $method The request VERB to use (GET, POST, PUT, DELETE) 100 | * @param string $path the API path 101 | * @param array $body The content to be used (either as the query, or the json post/put body) 102 | * 103 | * @return object 104 | * 105 | * @throws PostmarkException 106 | * @throws \GuzzleHttp\Exception\GuzzleException 107 | */ 108 | protected function processRestRequest($method = null, $path = null, array $body = []) 109 | { 110 | $client = $this->getClient(); 111 | 112 | $options = [ 113 | RequestOptions::HTTP_ERRORS => false, 114 | RequestOptions::HEADERS => [ 115 | 'User-Agent' => "Postmark-PHP (PHP Version:{$this->version}, OS:{$this->os})", 116 | 'Accept' => 'application/json', 117 | 'Content-Type' => 'application/json', 118 | $this->authorization_header => $this->authorization_token, 119 | ], 120 | ]; 121 | 122 | if (!empty($body)) { 123 | $cleanParams = array_filter($body, function ($value) { 124 | return null !== $value; 125 | }); 126 | 127 | switch ($method) { 128 | case 'GET': 129 | case 'HEAD': 130 | case 'DELETE': 131 | case 'OPTIONS': 132 | $options[RequestOptions::QUERY] = $cleanParams; 133 | 134 | break; 135 | 136 | case 'PUT': 137 | case 'POST': 138 | case 'PATCH': 139 | $options[RequestOptions::JSON] = $cleanParams; 140 | 141 | break; 142 | } 143 | } 144 | 145 | $response = $client->request($method, self::$BASE_URL . $path, $options); 146 | 147 | switch ($response->getStatusCode()) { 148 | case 200: 149 | // Casting BIGINT as STRING instead of the default FLOAT, to avoid loss of precision. 150 | return json_decode((string) $response->getBody(), true, 512, JSON_BIGINT_AS_STRING); 151 | 152 | case 401: 153 | $ex = new PostmarkException(); 154 | $ex->message = 'Unauthorized: Missing or incorrect API token in header. ' . 155 | 'Please verify that you used the correct token when you constructed your client.'; 156 | $ex->setHttpStatusCode(401); 157 | 158 | throw $ex; 159 | 160 | case 500: 161 | $ex = new PostmarkException(); 162 | $ex->setHttpStatusCode(500); 163 | $ex->message = 'Internal Server Error: This is an issue with Postmark’s servers processing your request. ' . 164 | 'In most cases the message is lost during the process, ' . 165 | 'and Postmark is notified so that we can investigate the issue.'; 166 | 167 | throw $ex; 168 | 169 | case 503: 170 | $ex = new PostmarkException(); 171 | $ex->setHttpStatusCode(503); 172 | $ex->message = 'The Postmark API is currently unavailable, please try your request later.'; 173 | 174 | throw $ex; 175 | 176 | // This should cover case 422, and any others that are possible: 177 | default: 178 | $ex = new PostmarkException(); 179 | $body = json_decode((string) $response->getBody(), true); 180 | $ex->setHttpStatusCode($response->getStatusCode()); 181 | $ex->setPostmarkApiErrorCode($body['ErrorCode'] ?? 422); 182 | $ex->message = $body['Message'] ?? 'There was an unknown error.'; 183 | 184 | throw $ex; 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /testing_keys.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "READ_INBOUND_TEST_SERVER_TOKEN" : "", 3 | "READ_SELENIUM_TEST_SERVER_TOKEN" : "", 4 | "READ_SELENIUM_OPEN_TRACKING_TOKEN" : "", 5 | "READ_LINK_TRACKING_TEST_SERVER_TOKEN" : "", 6 | 7 | "WRITE_ACCOUNT_TOKEN" : "", 8 | "WRITE_TEST_SERVER_TOKEN" : "", 9 | "WRITE_TEST_SENDER_EMAIL_ADDRESS" : "apps@example.com", 10 | "WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE": "anything+[token]@wildbit.com", 11 | "WRITE_TEST_EMAIL_RECIPIENT_ADDRESS" : "andrew+testing@example.com", 12 | "WRITE_TEST_DOMAIN_NAME" : "example.com", 13 | "WRITE_TEST_DOMAIN_NAME": "asdf.example.com", 14 | 15 | "BASE_URL" : "https://api.postmarkapp.com" 16 | } 17 | -------------------------------------------------------------------------------- /tests/PostmarkAdminClientDataRemovalTest.php: -------------------------------------------------------------------------------- 1 | WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $drr = $client->createDataRemovalRequest('test@activecampaign.com', 'test2@activecampaign.com', true); 22 | 23 | $this->assertNotEmpty($drr->getID()); 24 | $this->assertNotEmpty($drr->getStatus()); 25 | } 26 | 27 | public function testCheckDataRemovalRequest() 28 | { 29 | $tk = parent::$testKeys; 30 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 31 | 32 | $createRequest = $client->createDataRemovalRequest('test@activecampaign.com', 'test2@activecampaign.com', true); 33 | $checkRequest = $client->getDataRemoval($createRequest->getID()); 34 | 35 | $this->assertNotEmpty($checkRequest->getID()); 36 | $this->assertNotEmpty($checkRequest->getStatus()); 37 | $this->assertEquals($checkRequest->getID(), $createRequest->getID()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/PostmarkAdminClientDomainTest.php: -------------------------------------------------------------------------------- 1 | WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $domains = $client->listDomains(); 22 | 23 | foreach ($domains->getDomains() as $key => $value) { 24 | if (preg_match('/test-php.+/', $value->Name)) { 25 | $client->deleteDomain($value->ID); 26 | } 27 | } 28 | } 29 | 30 | public function testClientCanGetDomainList() 31 | { 32 | $tk = parent::$testKeys; 33 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 34 | 35 | $domains = $client->listDomains(); 36 | 37 | $this->assertGreaterThan(0, $domains->getTotalCount()); 38 | $this->assertNotEmpty($domains->getDomains()); 39 | } 40 | 41 | public function testClientCanGetSingleDomain() 42 | { 43 | $tk = parent::$testKeys; 44 | 45 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 46 | 47 | $tempDomains = $client->listDomains()->getDomains(); 48 | $id = $tempDomains[0]->getID(); 49 | $domain = $client->getDomain($id); 50 | 51 | $this->assertNotEmpty($domain->getName()); 52 | } 53 | 54 | public function testClientCanCreateDomain() 55 | { 56 | $tk = parent::$testKeys; 57 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 58 | 59 | $domainName = 'test-php-create-' . $tk->WRITE_TEST_DOMAIN_NAME; 60 | 61 | $domain = $client->createDomain($domainName); 62 | 63 | $this->assertNotEmpty($domain->getID()); 64 | 65 | $this->assertNotEmpty($domain->getID()); 66 | $this->assertSame($domain->getCustomTrackingVerified(), false); 67 | $this->assertSame($domain->getCustomTrackingDomainCNAMEValue(), ''); 68 | $this->assertSame($domain->getCustomTrackingDomain(), ''); 69 | } 70 | 71 | public function testClientCanEditDomain() 72 | { 73 | $tk = parent::$testKeys; 74 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 75 | 76 | $domainName = 'test-php-edit-' . $tk->WRITE_TEST_DOMAIN_NAME; 77 | $returnPath = 'return.' . $domainName; 78 | 79 | $domain = $client->createDomain($domainName, $returnPath); 80 | 81 | $updated = $client->editDomain($domain->getID(), 'updated-' . $returnPath); 82 | 83 | $this->assertNotSame($domain->getReturnPathDomain(), $updated->getReturnPathDomain()); 84 | } 85 | 86 | public function testClientCanDeleteDomain() 87 | { 88 | $tk = parent::$testKeys; 89 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 90 | 91 | $domainName = $tk->WRITE_TEST_DOMAIN_NAME; 92 | 93 | $name = 'test-php-delete-' . $domainName; 94 | $domain = $client->createDomain($name); 95 | 96 | $client->deleteDomain($domain->getID()); 97 | 98 | $domains = $client->listDomains()->getDomains(); 99 | 100 | foreach ($domains as $key => $value) { 101 | $this->assertNotSame($domain->getName(), $value->getName()); 102 | } 103 | } 104 | 105 | public function testClientCanVerifyDKIM() 106 | { 107 | $tk = parent::$testKeys; 108 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 109 | 110 | $domains = $client->listDomains()->getDomains(); 111 | foreach ($domains as $key => $value) { 112 | $verify = $client->verifyDKIM($value->ID); 113 | 114 | $this->assertSame($verify->getID(), $value->getID()); 115 | $this->assertSame($verify->getName(), $value->getName()); 116 | } 117 | } 118 | 119 | public function testClientCanVerifyReturnPath() 120 | { 121 | $tk = parent::$testKeys; 122 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 123 | 124 | $domains = $client->listDomains()->getDomains(); 125 | foreach ($domains as $key => $value) { 126 | $verify = $client->verifyReturnPath($value->getID()); 127 | 128 | $this->assertSame($verify->getID(), $value->getID()); 129 | $this->assertSame($verify->getName(), $value->getName()); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /tests/PostmarkAdminClientSenderSignatureTest.php: -------------------------------------------------------------------------------- 1 | WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $signatures = $client->listSenderSignatures(); 22 | 23 | foreach ($signatures->getSenderSignatures() as $key => $value) { 24 | if (preg_match('/test-php.+/', $value->getName()) > 0) { 25 | $client->deleteSenderSignature($value->getID()); 26 | } 27 | } 28 | } 29 | 30 | public function testClientCanGetSignatureList() 31 | { 32 | $tk = parent::$testKeys; 33 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 34 | 35 | $sigs = $client->listSenderSignatures(); 36 | 37 | $this->assertGreaterThan(0, $sigs->getTotalCount()); 38 | $this->assertNotEmpty($sigs->getSenderSignatures()); 39 | } 40 | 41 | public function testClientCanGetSingleSignature() 42 | { 43 | $tk = parent::$testKeys; 44 | 45 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 46 | $id = $client->listSenderSignatures()->getSenderSignatures()[0]->getID(); 47 | $sig = $client->getSenderSignature($id); 48 | 49 | $this->assertNotEmpty($sig->getName()); 50 | } 51 | 52 | public function testClientCanCreateSignature() 53 | { 54 | $tk = parent::$testKeys; 55 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 56 | 57 | $i = $tk->WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE; 58 | $sender = str_replace('[TOKEN]', 'test-php-create' . date('U'), $i); 59 | $name = 'test-php-create-' . date('U'); 60 | $note = 'This is a test note'; 61 | 62 | $sig = $client->createSenderSignature($sender, $name, null, null, $note); 63 | 64 | $this->assertNotEmpty($sig->getID()); 65 | $this->assertEquals($sender, $sig->getEmailAddress()); 66 | $this->assertEquals($name, $sig->getName()); 67 | $this->assertEquals($note, $sig->getConfirmationPersonalNote()); 68 | } 69 | 70 | public function testClientCanEditSignature() 71 | { 72 | $tk = parent::$testKeys; 73 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 74 | 75 | $name = 'test-php-edit-' . date('U'); 76 | 77 | $i = $tk->WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE; 78 | $sender = str_replace('[TOKEN]', 'test-php-edit' . date('U'), $i); 79 | 80 | $exploded = explode('@', $tk->WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE); 81 | $returnPath = 'test.' . $exploded[1]; 82 | 83 | $sig = $client->createSenderSignature($sender, $name, null, $returnPath); 84 | 85 | $updated = $client->editSenderSignature( 86 | $sig->getID(), 87 | $name . '-updated', 88 | null, 89 | 'updated-' . $returnPath 90 | ); 91 | 92 | $this->assertNotSame($sig->getName(), $updated->getName()); 93 | $this->assertNotSame($sig->getReturnpathdomain(), $updated->getReturnpathdomain()); 94 | } 95 | 96 | public function testClientCanDeleteSignature() 97 | { 98 | $tk = parent::$testKeys; 99 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 100 | 101 | $i = $tk->WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE; 102 | $sender = str_replace('[TOKEN]', 'test-php-delete' . date('U'), $i); 103 | 104 | $name = 'test-php-delete-' . date('U'); 105 | $sig = $client->createSenderSignature($sender, $name); 106 | 107 | $client->deleteSenderSignature($sig->getID()); 108 | 109 | $sigs = $client->listSenderSignatures()->getSenderSignatures(); 110 | 111 | foreach ($sigs as $key => $value) { 112 | $this->assertNotSame($sig->getName(), $value->getName()); 113 | } 114 | } 115 | 116 | public function testClientCanRequestNewVerificationForSignature() 117 | { 118 | $tk = parent::$testKeys; 119 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 120 | 121 | $i = $tk->WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE; 122 | $sender = str_replace('[TOKEN]', 'test-php-reverify' . date('U'), $i); 123 | 124 | $name = 'test-php-reverify-' . date('U'); 125 | $sig = $client->createSenderSignature($sender, $name); 126 | 127 | $result = $client->resendSenderSignatureConfirmation($sig->getID()); 128 | 129 | $this->assertEquals(0, $result->getErrorCode()); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /tests/PostmarkAdminClientServersTest.php: -------------------------------------------------------------------------------- 1 | WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $servers = $client->listServers(); 22 | 23 | foreach ($servers->getServers() as $key => $value) { 24 | if (preg_match('/^test-php.+/', $value->getName()) > 0 && !empty($value->getID())) { 25 | $client->deleteServer($value->getID()); 26 | } 27 | } 28 | } 29 | 30 | public function testClientCanGetServerList() 31 | { 32 | $tk = parent::$testKeys; 33 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 34 | 35 | $servers = $client->listServers(); 36 | 37 | $this->assertGreaterThan(0, $servers->getTotalcount()); 38 | $this->assertNotEmpty($servers->getServers()[0]); 39 | } 40 | 41 | public function testClientCanGetSingleServer() 42 | { 43 | $tk = parent::$testKeys; 44 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 45 | 46 | $servers = $client->listServers(); 47 | $targetId = $servers->getServers()[0]->getID(); 48 | 49 | $server = $client->getServer($targetId); 50 | 51 | $this->assertNotEmpty($server->getName()); 52 | } 53 | 54 | public function testClientCanCreateServer() 55 | { 56 | $tk = parent::$testKeys; 57 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 58 | 59 | $server = $client->createServer('test-php-create-' . date('c')); 60 | $this->assertNotEmpty($server); 61 | } 62 | 63 | public function testClientCanEditServer() 64 | { 65 | $tk = parent::$testKeys; 66 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 67 | 68 | $server = $client->createServer('test-php-edit-' . date('c'), 'purple'); 69 | 70 | $updateName = 'test-php-edit-' . date('c') . '-updated'; 71 | $serverUpdated = $client->editServer($server->getID(), $updateName, 'green'); 72 | 73 | $this->assertNotEmpty($serverUpdated); 74 | $this->assertNotSame($serverUpdated->getName(), $server->getName()); 75 | $this->assertNotSame($serverUpdated->getColor(), $server->getColor()); 76 | } 77 | 78 | public function testClientCanDeleteServer() 79 | { 80 | $tk = parent::$testKeys; 81 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 82 | 83 | $server = $client->createServer('test-php-delete-' . date('c')); 84 | 85 | $client->deleteServer($server->getID()); 86 | 87 | $serverList = $client->listServers(); 88 | foreach ($serverList->getServers() as $key => $value) { 89 | $this->assertNotSame($value->getID(), $server->getID()); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /tests/PostmarkClickClientStatisticsTest.php: -------------------------------------------------------------------------------- 1 | READ_LINK_TRACKING_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $stats = $client->getOutboundClickStatistics(); 22 | 23 | $this->assertNotNull($stats); 24 | } 25 | 26 | public function testClientCanGetClickBrowserFamilies() 27 | { 28 | $tk = parent::$testKeys; 29 | $client = new PostmarkClient($tk->READ_LINK_TRACKING_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 30 | 31 | $stats = $client->getOutboundClickBrowserFamilyStatistics(); 32 | 33 | $this->assertNotNull($stats); 34 | } 35 | 36 | public function testClientCanGetClickBrowserPlatformStatistics() 37 | { 38 | $tk = parent::$testKeys; 39 | $client = new PostmarkClient($tk->READ_LINK_TRACKING_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 40 | 41 | $stats = $client->getOutboundClickBrowserPlatformStatistics(); 42 | 43 | $this->assertNotEmpty($stats); 44 | } 45 | 46 | public function testClientCanGetClickLocationStatistics() 47 | { 48 | $tk = parent::$testKeys; 49 | $client = new PostmarkClient($tk->READ_LINK_TRACKING_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 50 | 51 | $stats = $client->getOutboundClickLocationStatistics(); 52 | 53 | $this->assertNotNull($stats); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/PostmarkClientBaseTest.php: -------------------------------------------------------------------------------- 1 | BASE_URL ?: 'https://api.postmarkapp.com'; 20 | date_default_timezone_set('UTC'); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/PostmarkClientBounceTest.php: -------------------------------------------------------------------------------- 1 | READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 25 | 26 | $stats = $client->getDeliveryStatistics(); 27 | 28 | $this->assertNotEmpty($stats, 'Stats from getDeliveryStatistics() should never be null or empty.'); 29 | $this->assertGreaterThan(0, $stats->getInactiveMails(), 'The inactive mail count should be greater than zero.'); 30 | } 31 | 32 | public function testClientCanGetBounces() 33 | { 34 | $tk = parent::$testKeys; 35 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 36 | 37 | $bounces = $client->getBounces(10, 0); 38 | $this->assertNotEmpty($bounces); 39 | } 40 | 41 | public function testClientCanGetBounce() 42 | { 43 | $tk = parent::$testKeys; 44 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 45 | $bounces = $client->getBounces(10, 0); 46 | $id = $bounces->getBounces()[0]->getID(); 47 | $bounce = $client->getBounce($id); 48 | $this->assertNotEmpty($bounce); 49 | $this->assertEquals($id, $bounce->getID()); 50 | } 51 | 52 | public function testClientCanGetBounceDump() 53 | { 54 | $tk = parent::$testKeys; 55 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 56 | $bounces = $client->getBounces(10, 0); 57 | $id = $bounces->Bounces[0]->getID(); 58 | $dump = $client->getBounceDump($id); 59 | $this->assertNotEmpty($dump); 60 | $this->assertNotEmpty($dump->getBody()); 61 | } 62 | 63 | public function testClientCanActivateBounce() 64 | { 65 | $tk = parent::$testKeys; 66 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 67 | 68 | // make sure that this email is not suppressed 69 | // generate a bounces 70 | $fromEmail = $tk->WRITE_TEST_SENDER_EMAIL_ADDRESS; 71 | $toEmail = 'hardbounce@bounce-testing.postmarkapp.com'; // special email to generate bounce 72 | $subject = 'Hello from Postmark!'; 73 | $htmlBody = 'Hello dear Postmark user.'; 74 | $textBody = 'Hello dear Postmark user.'; 75 | $tag = 'example-email-tag'; 76 | $trackOpens = true; 77 | $trackLinks = 'None'; 78 | 79 | $sendResult = $client->sendEmail( 80 | $fromEmail, 81 | $toEmail, 82 | $subject, 83 | $htmlBody, 84 | $textBody, 85 | $tag, 86 | $trackOpens, 87 | null, // Reply To 88 | null, // CC 89 | null, // BCC 90 | null, // Header array 91 | null, // Attachment array 92 | $trackLinks, 93 | null // Metadata array 94 | ); 95 | 96 | // make sure there is enough time for the bounce to take place. 97 | sleep(180); 98 | 99 | $bounceList = $client->getBounces(20, 0); 100 | $id = 0; 101 | $sentId = $sendResult->getMessageID(); 102 | $bounces = $bounceList->getBounces(); 103 | 104 | $this->assertNotEmpty($bounces); 105 | $this->assertNotEmpty($sentId); 106 | 107 | foreach ($bounces as $bounce) { 108 | $bmid = $bounce->getMessageID(); 109 | if ($sentId === $bmid) { 110 | $id = $bounce->getID(); 111 | 112 | break; 113 | } 114 | } 115 | 116 | $this->assertGreaterThan(0, $id); 117 | 118 | $bounceActivation = $client->activateBounce($id); 119 | $actBounce = $bounceActivation->getBounce(); 120 | 121 | $this->assertNotEmpty($actBounce); 122 | $this->assertEquals($id, $actBounce->getID()); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /tests/PostmarkClientEmailsAsStringOrArrayTest.php: -------------------------------------------------------------------------------- 1 | WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 20 | $currentTime = date('c'); 21 | $emailsAsArray = []; 22 | for ($i = 1; $i <= 50; ++$i) { 23 | $emailsAsArray[] = str_replace('@', '+' . $i . '@', $tk->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS); 24 | } 25 | 26 | $response = $client->sendEmail( 27 | $tk->WRITE_TEST_SENDER_EMAIL_ADDRESS, 28 | $emailsAsArray, 29 | "Hello from the PHP Postmark Client Tests! ({$currentTime})", 30 | 'Hi there!', 31 | 'This is a text body for a test email.', 32 | ); 33 | $this->assertNotEmpty($response, 'The client could not send a basic message.'); 34 | } 35 | 36 | public function testCanSendString(): void 37 | { 38 | $tk = parent::$testKeys; 39 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 40 | $currentTime = date('c'); 41 | $emailsAsString = ''; 42 | for ($i = 1; $i <= 50; ++$i) { 43 | $emailsAsString .= str_replace('@', '+' . $i . '@', $tk->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS) . ','; 44 | } 45 | 46 | $response = $client->sendEmail( 47 | $tk->WRITE_TEST_SENDER_EMAIL_ADDRESS, 48 | $emailsAsString, 49 | "Hello from the PHP Postmark Client Tests! ({$currentTime})", 50 | 'Hi there!', 51 | 'This is a text body for a test email.', 52 | ); 53 | $this->assertNotEmpty($response, 'The client could not send a basic message.'); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /tests/PostmarkClientInboundMessageTest.php: -------------------------------------------------------------------------------- 1 | READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $messages = $client->getInboundMessages(10); 22 | 23 | $this->assertNotEmpty($messages); 24 | $this->assertCount(10, $messages->getInboundMessages()); 25 | } 26 | 27 | public function testClientCanGetInboundMessageDetails() 28 | { 29 | $tk = parent::$testKeys; 30 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 31 | 32 | $retrievedMessages = $client->getInboundMessages(10); 33 | $baseMessageId = $retrievedMessages->getInboundMessages()[0]->getMessageID(); 34 | $message = $client->getInboundMessageDetails($baseMessageId); 35 | 36 | $this->assertNotEmpty($message); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/PostmarkClientMessageStreamsTest.php: -------------------------------------------------------------------------------- 1 | WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 21 | 22 | $servers = $client->listServers(); 23 | 24 | foreach ($servers->getServers() as $key => $value) { 25 | if (preg_match('/^test-php-streams.+/', $value->getName()) > 0 && !empty($value->getID())) { 26 | $client->deleteServer($value->getID()); 27 | } 28 | } 29 | } 30 | 31 | // create message stream 32 | public function testClientCanCreateMessageStream() 33 | { 34 | $tk = parent::$testKeys; 35 | $server = self::getNewServer(); 36 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 37 | 38 | $id = 'test-stream'; 39 | $messageStreamType = 'Broadcasts'; 40 | $name = 'Test Stream Name'; 41 | $description = 'Test Stream Description'; 42 | 43 | $createdStream = $client->createMessageStream($id, $messageStreamType, $name, $description); 44 | 45 | $this->assertEquals($id, $createdStream->getID()); 46 | $this->assertEquals($server->getID(), $createdStream->getServerId()); 47 | $this->assertEquals($messageStreamType, $createdStream->getMessageStreamType()); 48 | $this->assertEquals($name, $createdStream->getName()); 49 | $this->assertEquals($description, $createdStream->getDescription()); 50 | $this->assertNotNull($createdStream->getCreatedAt()); 51 | $this->assertNull($createdStream->getUpdatedAt()); 52 | $this->assertNull($createdStream->getArchivedAt()); 53 | } 54 | 55 | // edit message stream 56 | public function testClientCanEditMessageStream() 57 | { 58 | $tk = parent::$testKeys; 59 | $server = self::getNewServer(); 60 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 61 | 62 | $id = 'test-stream'; 63 | $messageStreamType = 'Broadcasts'; 64 | $name = 'Test Stream Name'; 65 | $description = 'Test Stream Description'; 66 | 67 | $client->createMessageStream($id, $messageStreamType, $name, $description); 68 | 69 | $updatedName = 'New Name'; 70 | $updatedDescription = 'New Description'; 71 | 72 | $updatedStream = $client->editMessageStream($id, $updatedName, $updatedDescription); 73 | 74 | $this->assertEquals($id, $updatedStream->getID()); 75 | $this->assertEquals($updatedName, $updatedStream->getName()); 76 | $this->assertEquals($updatedDescription, $updatedStream->getDescription()); 77 | $this->assertNotNull($updatedStream->getUpdatedAt()); 78 | } 79 | 80 | // get message stream 81 | public function testClientCanGetMessageStream() 82 | { 83 | $tk = parent::$testKeys; 84 | $server = self::getNewServer(); 85 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 86 | 87 | $id = 'test-stream'; 88 | $messageStreamType = 'Broadcasts'; 89 | $name = 'Test Stream Name'; 90 | $description = 'Test Stream Description'; 91 | 92 | $client->createMessageStream($id, $messageStreamType, $name, $description); 93 | 94 | $fetchedStream = $client->getMessageStream($id); 95 | 96 | $this->assertEquals($id, $fetchedStream->getID()); 97 | $this->assertEquals($messageStreamType, $fetchedStream->getMessageStreamType()); 98 | $this->assertEquals($name, $fetchedStream->getName()); 99 | $this->assertEquals($description, $fetchedStream->getDescription()); 100 | } 101 | 102 | // list message streams 103 | public function testClientCanListMessageStreams() 104 | { 105 | $tk = parent::$testKeys; 106 | $server = self::getNewServer(); 107 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 108 | 109 | $broadcastsStream = $client->createMessageStream('test-stream', 'Broadcasts', 'Test Stream Name'); 110 | 111 | $this->assertEquals(4, $client->listMessageStreams()->getTotalCount()); // Includes 3 default streams 112 | 113 | $filteredStreams = $client->listMessageStreams('Broadcasts'); 114 | 115 | $this->assertEquals(2, $filteredStreams->getTotalCount()); // Filter only our Broadcasts streams 116 | } 117 | 118 | // list archived message streams 119 | public function testClientCanListArchivedStreams() 120 | { 121 | $tk = parent::$testKeys; 122 | $server = self::getNewServer(); 123 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 124 | 125 | $newStream = $client->createMessageStream('test-stream', 'Broadcasts', 'Test Stream Name'); 126 | 127 | // 2 broadcast streams, including the default one 128 | $this->assertEquals(2, $client->listMessageStreams('Broadcasts')->getTotalCount()); 129 | 130 | $client->archiveMessageStream($newStream->getID()); 131 | 132 | // Filtering out archived streams by default 133 | $this->assertEquals(1, $client->listMessageStreams('Broadcasts')->getTotalCount()); 134 | 135 | // Allowing archived streams in the result 136 | $this->assertEquals(2, $client->listMessageStreams('Broadcasts', 'true')->getTotalCount()); 137 | } 138 | 139 | // archive message streams 140 | public function testClientCanArchiveStreams() 141 | { 142 | $tk = parent::$testKeys; 143 | $server = self::getNewServer(); 144 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 145 | 146 | $newStream = $client->createMessageStream('test-stream', 'Broadcasts', 'Test Stream Name'); 147 | $archivedStream = $client->archiveMessageStream($newStream->getID()); 148 | 149 | $this->assertEquals($newStream->getID(), $archivedStream->getID()); 150 | $this->assertEquals($newStream->getServerId(), $archivedStream->getServerId()); 151 | $this->assertNotNull($archivedStream->getExpectedPurgeDate()); 152 | 153 | $fetchedStream = $client->getMessageStream($archivedStream->getID()); 154 | $this->assertNotNull($fetchedStream->getArchivedAt()); 155 | } 156 | 157 | // unarchive message streams 158 | public function testClientCanUnarchiveStreams() 159 | { 160 | $tk = parent::$testKeys; 161 | $server = self::getNewServer(); 162 | $client = new PostmarkClient($server->ApiTokens[0], $tk->TEST_TIMEOUT); 163 | 164 | $newStream = $client->createMessageStream('test-stream', 'Broadcasts', 'Test Stream Name'); 165 | $client->archiveMessageStream($newStream->getID()); 166 | 167 | $unarchivedStream = $client->unArchiveMessageStream($newStream->getID()); 168 | 169 | $this->assertNull($unarchivedStream->getArchivedAt()); 170 | } 171 | 172 | private static function getNewServer() 173 | { 174 | $tk = parent::$testKeys; 175 | $client = new PostmarkAdminClient($tk->WRITE_ACCOUNT_TOKEN, $tk->TEST_TIMEOUT); 176 | 177 | return $client->createServer('test-php-streams-' . uniqid()); 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /tests/PostmarkClientOutboundMessageTest.php: -------------------------------------------------------------------------------- 1 | READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $messages = $client->getOutboundMessages(10); 22 | $this->assertNotEmpty($messages); 23 | $this->assertCount(10, $messages->getMessages()); 24 | } 25 | 26 | public function testClientCanGetOutboundMessageDetails() 27 | { 28 | $tk = parent::$testKeys; 29 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 30 | 31 | $retrievedMessages = $client->getOutboundMessages(1, 50); 32 | 33 | $baseMessageId = $retrievedMessages->getMessages()[0]->getMessageID(); 34 | $message = $client->getOutboundMessageDetails($baseMessageId); 35 | 36 | $this->assertNotEmpty($message); 37 | } 38 | 39 | public function testClientCanGetOutboundMessageDump() 40 | { 41 | $tk = parent::$testKeys; 42 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 43 | 44 | $retrievedMessages = $client->getOutboundMessages(1, 50); 45 | $baseMessageId = $retrievedMessages->getMessages()[0]->getMessageID(); 46 | $message = $client->getOutboundMessageDump($baseMessageId); 47 | 48 | $this->assertNotEmpty($message); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/PostmarkClientRuleTriggerTest.php: -------------------------------------------------------------------------------- 1 | WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 22 | 23 | $triggers = $client->listInboundRuleTriggers(); 24 | 25 | $this->assertNotEmpty($triggers); 26 | } 27 | 28 | public function testClientCanCreateAndDeleteRuleTriggers() 29 | { 30 | $tk = parent::$testKeys; 31 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 32 | 33 | $trigger = $client->createInboundRuleTrigger('test.php+' . uniqid('', true) . '@example.com'); 34 | $this->assertNotEmpty($trigger); 35 | 36 | $client->deleteInboundRuleTrigger($trigger->getID()); 37 | // Not throwing an exception here constitutes passing. 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tests/PostmarkClientServerTest.php: -------------------------------------------------------------------------------- 1 | WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 20 | $server = $client->getServer(); 21 | $this->assertNotEmpty($server); 22 | } 23 | 24 | public function testClientCanEditServerInformation() 25 | { 26 | $tk = parent::$testKeys; 27 | 28 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 29 | $originalServer = $client->getServer(); 30 | 31 | $server = $client->editServer('testing-server-' . rand(0, 1000) . '-' . date('c')); 32 | 33 | // set it back to the original name. 34 | $client->editServer($originalServer->getName()); 35 | $this->assertNotSame($originalServer->getName(), $server->getName()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/PostmarkClientStatisticsTest.php: -------------------------------------------------------------------------------- 1 | READ_SELENIUM_OPEN_TRACKING_TOKEN, $tk->TEST_TIMEOUT); 20 | 21 | $stats = $client->getOpenStatistics(); 22 | $this->assertNotEmpty($stats); 23 | } 24 | 25 | public function testClientCanGetMessageOpensForSpecificMessage() 26 | { 27 | $tk = parent::$testKeys; 28 | $client = new PostmarkClient($tk->READ_SELENIUM_OPEN_TRACKING_TOKEN, $tk->TEST_TIMEOUT); 29 | 30 | $stats = $client->getOpenStatistics(); 31 | 32 | $messageId = $stats->getOpens()[0]->getMessageID(); 33 | $result = $client->getOpenStatisticsForMessage($messageId); 34 | 35 | $this->assertNotEmpty($result); 36 | } 37 | 38 | // function testClientCanGetMessageClicks() { 39 | // $tk = parent::$testKeys; 40 | // $client = new PostmarkClient($tk->READ_SELENIUM_OPEN_TRACKING_TOKEN, $tk->TEST_TIMEOUT); 41 | // 42 | // $stats = $client->getClickStatistics(); 43 | // $this->assertNotEmpty($stats); 44 | // } 45 | // 46 | // function testClientCanGetMessageClickForSpecificMessage() { 47 | // $tk = parent::$testKeys; 48 | // $client = new PostmarkClient($tk->READ_SELENIUM_OPEN_TRACKING_TOKEN, $tk->TEST_TIMEOUT); 49 | // 50 | // $stats = $client->getClickStatistics(); 51 | // 52 | // $messageId = $stats->getClicks()[0]->getMessageID(); 53 | // $result = $client->getClickStatisticsForMessage($messageId); 54 | // 55 | // $this->assertNotEmpty($result); 56 | // } 57 | 58 | public function testClientCanGetOutboundOverviewStatistics() 59 | { 60 | $tk = parent::$testKeys; 61 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 62 | 63 | $stats = $client->getOutboundOverviewStatistics(); 64 | 65 | $this->assertNotEmpty($stats); 66 | } 67 | 68 | public function testClientCanGetOutboundSendStatistics() 69 | { 70 | $tk = parent::$testKeys; 71 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 72 | 73 | $stats = $client->getOutboundSendStatistics(); 74 | 75 | $this->assertNotEmpty($stats); 76 | } 77 | 78 | public function testClientCanGetOutboundBounceStatistics() 79 | { 80 | $tk = parent::$testKeys; 81 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 82 | 83 | $stats = $client->getOutboundBounceStatistics(); 84 | 85 | $this->assertNotEmpty($stats); 86 | } 87 | 88 | public function testClientCanGetOutboundSpamComplaintStatistics() 89 | { 90 | $tk = parent::$testKeys; 91 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 92 | 93 | $stats = $client->getOutboundSpamComplaintStatistics(); 94 | 95 | $this->assertNotEmpty($stats); 96 | } 97 | 98 | public function testClientCanGetOutboundTrackedStatistics() 99 | { 100 | $tk = parent::$testKeys; 101 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 102 | 103 | $stats = $client->getOutboundTrackedStatistics(); 104 | 105 | $this->assertNotEmpty($stats); 106 | } 107 | 108 | public function testClientCanGetOutboundOpenStatistics() 109 | { 110 | $tk = parent::$testKeys; 111 | $client = new PostmarkClient($tk->READ_SELENIUM_OPEN_TRACKING_TOKEN, $tk->TEST_TIMEOUT); 112 | 113 | $stats = $client->getOutboundOpenStatistics(); 114 | 115 | $this->assertNotEmpty($stats); 116 | } 117 | 118 | public function testClientCanGetOutboundPlatformStatistics() 119 | { 120 | $tk = parent::$testKeys; 121 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 122 | 123 | $stats = $client->getOutboundPlatformStatistics(); 124 | 125 | $this->assertNotEmpty($stats); 126 | } 127 | 128 | public function testClientCanGetOutboundEmailClientStatistics() 129 | { 130 | $tk = parent::$testKeys; 131 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 132 | 133 | $stats = $client->getOutboundEmailClientStatistics(); 134 | 135 | $this->assertNotEmpty($stats); 136 | } 137 | 138 | public function testClientCanGetOutboundReadTimeStatistics() 139 | { 140 | $tk = parent::$testKeys; 141 | $client = new PostmarkClient($tk->READ_SELENIUM_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 142 | 143 | $stats = $client->getOutboundReadTimeStatistics(); 144 | 145 | $this->assertNotEmpty($stats); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /tests/PostmarkClientSuppressionsTest.php: -------------------------------------------------------------------------------- 1 | WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 22 | 23 | // remove all suppressions on the default stream 24 | $sups = $client->getSuppressions(); 25 | foreach ($sups->getSuppressions() as $sup) { 26 | $suppressionChanges = [new SuppressionChangeRequest($sup->getEmailAddress())]; 27 | $messageStream = 'outbound'; 28 | $client->deleteSuppressions($suppressionChanges, $messageStream); 29 | } 30 | } 31 | 32 | // create suppression 33 | public function testClientCanCreateSuppressions() 34 | { 35 | $tk = parent::$testKeys; 36 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 37 | 38 | $emailAddress = 'test-email@example.com'; 39 | $suppressionChanges = [new SuppressionChangeRequest($emailAddress)]; 40 | 41 | $messageStream = 'outbound'; 42 | 43 | $result = $client->createSuppressions($suppressionChanges, $messageStream); 44 | 45 | $this->assertEquals($emailAddress, $result->getSuppressions()[0]->getEmailAddress()); 46 | $this->assertEquals('Suppressed', $result->getSuppressions()[0]->getStatus()); 47 | } 48 | 49 | // create suppression with default message stream 50 | public function testDefaultMessageStream() 51 | { 52 | $tk = parent::$testKeys; 53 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 54 | 55 | $emailAddress = 'test-email@example.com'; 56 | $suppressionChanges = [new SuppressionChangeRequest($emailAddress)]; 57 | 58 | $result = $client->createSuppressions($suppressionChanges); 59 | 60 | $this->assertEquals($emailAddress, $result->getSuppressions()[0]->getEmailAddress()); 61 | $this->assertEquals('Suppressed', $result->getSuppressions()[0]->getStatus()); 62 | } 63 | 64 | // reactivate suppression 65 | public function testClientCanReactivateSuppressions() 66 | { 67 | $tk = parent::$testKeys; 68 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 69 | 70 | $emailAddress = 'test-email@example.com'; 71 | $suppressionChanges = [new SuppressionChangeRequest($emailAddress)]; 72 | 73 | $messageStream = 'outbound'; 74 | 75 | $result = $client->deleteSuppressions($suppressionChanges, $messageStream); 76 | 77 | $this->assertEquals($emailAddress, $result->getSuppressions()[0]->getEmailAddress()); 78 | $this->assertEquals('Deleted', $result->getSuppressions()[0]->getStatus()); 79 | } 80 | 81 | // invalid request returns failed Status 82 | public function testInvalidSuppressionChangeRequestReturnsFailedStatus() 83 | { 84 | $tk = parent::$testKeys; 85 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 86 | 87 | $emailAddress = 'invalid-email'; 88 | $suppressionChanges = [new SuppressionChangeRequest($emailAddress)]; 89 | 90 | $messageStream = 'outbound'; 91 | 92 | $result = $client->createSuppressions($suppressionChanges, $messageStream); 93 | 94 | $this->assertEquals($emailAddress, $result->getSuppressions()[0]->getEmailAddress()); 95 | $this->assertEquals('Failed', $result->getSuppressions()[0]->getStatus()); 96 | } 97 | 98 | // multiple requests are supported 99 | public function testClientCanCreateMultipleSuppressions() 100 | { 101 | $tk = parent::$testKeys; 102 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 103 | 104 | $suppressionChanges = []; 105 | for ($i = 0; $i < 5; ++$i) { 106 | $emailAddress = "test-email-{$i}@example.com"; 107 | $suppressionChanges[] = new SuppressionChangeRequest($emailAddress); 108 | } 109 | 110 | $messageStream = 'outbound'; 111 | 112 | $result = $client->createSuppressions($suppressionChanges, $messageStream); 113 | 114 | $this->assertNotEmpty($result->getSuppressions()); 115 | foreach ($result->getSuppressions() as $suppressionChangeResult) { 116 | $this->assertEquals('Suppressed', $suppressionChangeResult->getStatus()); 117 | } 118 | } 119 | 120 | // invalid message stream throws exception 121 | public function testInvalidMessageStreamThrowsException() 122 | { 123 | $tk = parent::$testKeys; 124 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 125 | 126 | $emailAddress = 'test-email@email.com'; 127 | $suppressionChanges = [new SuppressionChangeRequest($emailAddress)]; 128 | 129 | $messageStream = '123-invalid-stream-php-test'; 130 | 131 | try { 132 | $result = $client->createSuppressions($suppressionChanges, $messageStream); 133 | } catch (PostmarkException $ex) { 134 | $this->assertEquals(422, $ex->getHttpStatusCode()); 135 | $this->assertEquals("The message stream for the provided 'ID' was not found.", $ex->getMessage()); 136 | } 137 | } 138 | 139 | // get suppressions 140 | public function testGetSuppressionsIsNotEmpty() 141 | { 142 | $tk = parent::$testKeys; 143 | $client = new PostmarkClient($tk->WRITE_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT); 144 | 145 | $result = $client->getSuppressions(); 146 | $this->assertNotEmpty($result); 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /tests/TestingKeys.php: -------------------------------------------------------------------------------- 1 | TEST_TIMEOUT = (int) (getenv('TEST_TIMEOUT') ?: '60'); 34 | 35 | $this->READ_INBOUND_TEST_SERVER_TOKEN = getenv('READ_INBOUND_TEST_SERVER_TOKEN') ?: $test_keys['READ_INBOUND_TEST_SERVER_TOKEN']; 36 | $this->READ_SELENIUM_OPEN_TRACKING_TOKEN = getenv('READ_SELENIUM_OPEN_TRACKING_TOKEN') ?: $test_keys['READ_SELENIUM_OPEN_TRACKING_TOKEN']; 37 | $this->READ_SELENIUM_TEST_SERVER_TOKEN = getenv('READ_SELENIUM_TEST_SERVER_TOKEN') ?: $test_keys['READ_SELENIUM_TEST_SERVER_TOKEN']; 38 | $this->READ_LINK_TRACKING_TEST_SERVER_TOKEN = getenv('READ_LINK_TRACKING_TEST_SERVER_TOKEN') ?: $test_keys['READ_LINK_TRACKING_TEST_SERVER_TOKEN']; 39 | 40 | $this->WRITE_ACCOUNT_TOKEN = getenv('WRITE_ACCOUNT_TOKEN') ?: $test_keys['WRITE_ACCOUNT_TOKEN']; 41 | $this->WRITE_TEST_SERVER_TOKEN = getenv('WRITE_TEST_SERVER_TOKEN') ?: $test_keys['WRITE_TEST_SERVER_TOKEN']; 42 | $this->WRITE_TEST_SENDER_EMAIL_ADDRESS = getenv('WRITE_TEST_SENDER_EMAIL_ADDRESS') ?: $test_keys['WRITE_TEST_SENDER_EMAIL_ADDRESS']; 43 | $this->WRITE_TEST_EMAIL_RECIPIENT_ADDRESS = getenv('WRITE_TEST_EMAIL_RECIPIENT_ADDRESS') ?: $test_keys['WRITE_TEST_EMAIL_RECIPIENT_ADDRESS']; 44 | $this->WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE = getenv('WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE') ?: $test_keys['WRITE_TEST_SENDER_SIGNATURE_PROTOTYPE']; 45 | $this->WRITE_TEST_DOMAIN_NAME = getenv('WRITE_TEST_DOMAIN_NAME') ?: $test_keys['WRITE_TEST_DOMAIN_NAME']; 46 | 47 | $this->BASE_URL = getenv('BASE_URL') ?: $test_keys['BASE_URL']; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /tests/postmark-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ActiveCampaign/postmark-php/cf309a283e09bae0c6e1cac19e592c8eedb6a619/tests/postmark-logo.png --------------------------------------------------------------------------------