├── .gitattributes ├── .gitignore ├── License.txt ├── Makefile ├── README.md ├── composer.json ├── composer.lock ├── examples └── example.php ├── src ├── ElasticEmailApi │ ├── AccessToken.php │ ├── Account.php │ ├── Campaign.php │ ├── Channel.php │ ├── Contact.php │ ├── Domain.php │ ├── EEList.php │ ├── Email.php │ ├── Export.php │ ├── File.php │ ├── Log.php │ ├── SMS.php │ ├── Segment.php │ ├── Template.php │ └── ValidEmail.php ├── ElasticEmailClient │ ├── ApiConfiguration.php │ ├── ElasticClient.php │ └── ElasticRequest.php └── ElasticEmailEnums │ ├── AccessLevel.php │ ├── AccessToken.php │ ├── Account.php │ ├── AccountOverview.php │ ├── AdvancedOptions.php │ ├── BlockedContact.php │ ├── BouncedCategorySummary.php │ ├── Campaign.php │ ├── CampaignChannel.php │ ├── CampaignStatus.php │ ├── CampaignTemplate.php │ ├── CampaignTriggerType.php │ ├── CertificateValidationStatus.php │ ├── Channel.php │ ├── CompressionFormat.php │ ├── ConsentTracking.php │ ├── Contact.php │ ├── ContactCollection.php │ ├── ContactContainer.php │ ├── ContactHistEventType.php │ ├── ContactHistory.php │ ├── ContactSort.php │ ├── ContactSource.php │ ├── ContactStatus.php │ ├── ContactStatusCounts.php │ ├── ContactUnsubscribeReasonCounts.php │ ├── DailyLogStatusSummary.php │ ├── DomainDetail.php │ ├── EEList.php │ ├── EmailCredits.php │ ├── EmailJobFailedStatus.php │ ├── EmailJobStatus.php │ ├── EmailSend.php │ ├── EmailStatus.php │ ├── EmailValidationResult.php │ ├── EmailValidationStatus.php │ ├── EmailView.php │ ├── EncodingType.php │ ├── EventLog.php │ ├── Export.php │ ├── ExportFileFormats.php │ ├── ExportLink.php │ ├── ExportStatus.php │ ├── ExportType.php │ ├── File.php │ ├── InboundOptions.php │ ├── IntervalType.php │ ├── LinkTrackingDetails.php │ ├── Log.php │ ├── LogEventStatus.php │ ├── LogJobStatus.php │ ├── LogStatusSummary.php │ ├── LogSummary.php │ ├── MessageCategory.php │ ├── NotificationType.php │ ├── Payment.php │ ├── Profile.php │ ├── Recipient.php │ ├── RecipientEvent.php │ ├── Referral.php │ ├── ReputationDetail.php │ ├── ReputationHistory.php │ ├── ReputationImpact.php │ ├── Segment.php │ ├── SegmentHistory.php │ ├── SendingPermission.php │ ├── SpamCheck.php │ ├── SpamRule.php │ ├── SplitOptimization.php │ ├── SubAccount.php │ ├── SubAccountSettings.php │ ├── SubaccountSummary.php │ ├── SupportPlan.php │ ├── Template.php │ ├── TemplateList.php │ ├── TemplateScope.php │ ├── TemplateTag.php │ ├── TemplateTagList.php │ ├── TemplateType.php │ ├── TrackedLink.php │ ├── TrackingType.php │ ├── TrackingValidationStatus.php │ ├── Usage.php │ ├── UsageData.php │ ├── ValidEmail.php │ ├── ValidationError.php │ ├── ValidationStatus.php │ ├── WebNotificationOptions.php │ └── Webhook.php └── tools └── file-splitter.php /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .DS_Store 3 | Thumbs.db 4 | npm-debug.log 5 | /bower_components 6 | /node_modules 7 | /vendor 8 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2017 Elastic Email, Inc. 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. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | build: 2 | wget http://api.elasticemail.com/public/client/php -O ./ElasticEmailClient.php 3 | rm -rf ./src/* 4 | php ./tools/file-splitter.php ./ElasticEmailClient.php ./src 5 | rm ./ElasticEmailClient.php -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **LEGACY** 2 | 3 | New version of API - https://github.com/ElasticEmail/elasticemail-php 4 | 5 | **This library allows you to quickly and easily use the Elastic Email Web API v2 via PHP.** 6 | 7 | # Prerequisites # 8 | * [An Elastic Email account](https://elasticemail.com/account/) 9 | 10 | # Instalation # 11 | ``` 12 | composer require elastic-email/web-api-client 13 | ``` 14 | # API # 15 | API documentation you can find on [Elastic Email website](https://api.elasticemail.com/public/help). 16 | 17 | # Examples # 18 | 19 | ##### Load account ##### 20 | ``` 21 | $loader = require_once(__DIR__.'/../vendor/autoload.php'); 22 | 23 | $configuration = new \ElasticEmailClient\ApiConfiguration([ 24 | 'apiUrl' => 'https://api.elasticemail.com/v2/', 25 | 'apiKey' => 'yourApiKey' 26 | ]); 27 | 28 | $client = new \ElasticEmailClient\ElasticClient($configuration); 29 | 30 | $clientData = $client->Account->Load(); 31 | ``` 32 | ##### Send email ##### 33 | ``` 34 | $loader = require_once(__DIR__.'/../vendor/autoload.php'); 35 | 36 | $configuration = new \ElasticEmailClient\ApiConfiguration([ 37 | 'apiUrl' => 'https://api.elasticemail.com/v2/', 38 | 'apiKey' => 'yourApiKey' 39 | ]); 40 | 41 | $client = new \ElasticEmailClient\ElasticClient($configuration); 42 | 43 | $client->Email->Send( 44 | "title", 45 | "from@email", 46 | "from name", 47 | null, 48 | null, 49 | null, 50 | null, 51 | null, 52 | null, 53 | array("to@email"), 54 | array(), 55 | array(), 56 | array(), 57 | array(), 58 | array(), 59 | null, 60 | null, 61 | null, 62 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", 63 | null 64 | ); 65 | ``` 66 | 67 | # About # 68 | ElasticEmail.WebApiClient is guided and supported by the ElasticEmail Dev Team. 69 | 70 | ElasticEmail.WebApiClient is maintained and funded by Elastic Email Inc. The names and logos for ElasticEmail.WebApiClient are trademarks of Elastic Email Inc. 71 | 72 | ![logo](https://elasticemail.com/files/ee_200x200.png) 73 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "elastic-email/web-api-client", 3 | "type": "library", 4 | "description": "Easily send emails with Elastic Email using Web API PHP Client https://elasticemail.com/", 5 | "keywords": ["elastic","email", "elasticemail", "transactional", "web", "api"], 6 | "homepage": "https://github.com/ElasticEmail/ElasticEmail.WebApiClient-php", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "ElasticEmail Dev Team", 11 | "email": "support@elasticemail.com", 12 | "homepage": "https://elasticemail.com/", 13 | "role": "Developer" 14 | } 15 | ], 16 | "require": { 17 | "php": ">=7.0.0", 18 | "guzzlehttp/guzzle": "^7.2" 19 | }, 20 | "autoload": { 21 | "psr-0": { "": "src/" } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "518e442182b87a544b8976d4c7b6adc6", 8 | "packages": [ 9 | { 10 | "name": "guzzlehttp/guzzle", 11 | "version": "7.2.0", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/guzzle/guzzle.git", 15 | "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79", 20 | "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "ext-json": "*", 25 | "guzzlehttp/promises": "^1.4", 26 | "guzzlehttp/psr7": "^1.7", 27 | "php": "^7.2.5 || ^8.0", 28 | "psr/http-client": "^1.0" 29 | }, 30 | "provide": { 31 | "psr/http-client-implementation": "1.0" 32 | }, 33 | "require-dev": { 34 | "ext-curl": "*", 35 | "php-http/client-integration-tests": "^3.0", 36 | "phpunit/phpunit": "^8.5.5 || ^9.3.5", 37 | "psr/log": "^1.1" 38 | }, 39 | "suggest": { 40 | "ext-curl": "Required for CURL handler support", 41 | "ext-intl": "Required for Internationalized Domain Name (IDN) support", 42 | "psr/log": "Required for using the Log middleware" 43 | }, 44 | "type": "library", 45 | "extra": { 46 | "branch-alias": { 47 | "dev-master": "7.1-dev" 48 | } 49 | }, 50 | "autoload": { 51 | "psr-4": { 52 | "GuzzleHttp\\": "src/" 53 | }, 54 | "files": [ 55 | "src/functions_include.php" 56 | ] 57 | }, 58 | "notification-url": "https://packagist.org/downloads/", 59 | "license": [ 60 | "MIT" 61 | ], 62 | "authors": [ 63 | { 64 | "name": "Michael Dowling", 65 | "email": "mtdowling@gmail.com", 66 | "homepage": "https://github.com/mtdowling" 67 | }, 68 | { 69 | "name": "Márk Sági-Kazár", 70 | "email": "mark.sagikazar@gmail.com", 71 | "homepage": "https://sagikazarmark.hu" 72 | } 73 | ], 74 | "description": "Guzzle is a PHP HTTP client library", 75 | "homepage": "http://guzzlephp.org/", 76 | "keywords": [ 77 | "client", 78 | "curl", 79 | "framework", 80 | "http", 81 | "http client", 82 | "psr-18", 83 | "psr-7", 84 | "rest", 85 | "web service" 86 | ], 87 | "funding": [ 88 | { 89 | "url": "https://github.com/GrahamCampbell", 90 | "type": "github" 91 | }, 92 | { 93 | "url": "https://github.com/Nyholm", 94 | "type": "github" 95 | }, 96 | { 97 | "url": "https://github.com/alexeyshockov", 98 | "type": "github" 99 | }, 100 | { 101 | "url": "https://github.com/gmponos", 102 | "type": "github" 103 | } 104 | ], 105 | "time": "2020-10-10T11:47:56+00:00" 106 | }, 107 | { 108 | "name": "guzzlehttp/promises", 109 | "version": "1.4.1", 110 | "source": { 111 | "type": "git", 112 | "url": "https://github.com/guzzle/promises.git", 113 | "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" 114 | }, 115 | "dist": { 116 | "type": "zip", 117 | "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", 118 | "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", 119 | "shasum": "" 120 | }, 121 | "require": { 122 | "php": ">=5.5" 123 | }, 124 | "require-dev": { 125 | "symfony/phpunit-bridge": "^4.4 || ^5.1" 126 | }, 127 | "type": "library", 128 | "extra": { 129 | "branch-alias": { 130 | "dev-master": "1.4-dev" 131 | } 132 | }, 133 | "autoload": { 134 | "psr-4": { 135 | "GuzzleHttp\\Promise\\": "src/" 136 | }, 137 | "files": [ 138 | "src/functions_include.php" 139 | ] 140 | }, 141 | "notification-url": "https://packagist.org/downloads/", 142 | "license": [ 143 | "MIT" 144 | ], 145 | "authors": [ 146 | { 147 | "name": "Michael Dowling", 148 | "email": "mtdowling@gmail.com", 149 | "homepage": "https://github.com/mtdowling" 150 | } 151 | ], 152 | "description": "Guzzle promises library", 153 | "keywords": [ 154 | "promise" 155 | ], 156 | "time": "2021-03-07T09:25:29+00:00" 157 | }, 158 | { 159 | "name": "guzzlehttp/psr7", 160 | "version": "1.7.0", 161 | "source": { 162 | "type": "git", 163 | "url": "https://github.com/guzzle/psr7.git", 164 | "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" 165 | }, 166 | "dist": { 167 | "type": "zip", 168 | "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", 169 | "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", 170 | "shasum": "" 171 | }, 172 | "require": { 173 | "php": ">=5.4.0", 174 | "psr/http-message": "~1.0", 175 | "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" 176 | }, 177 | "provide": { 178 | "psr/http-message-implementation": "1.0" 179 | }, 180 | "require-dev": { 181 | "ext-zlib": "*", 182 | "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" 183 | }, 184 | "suggest": { 185 | "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" 186 | }, 187 | "type": "library", 188 | "extra": { 189 | "branch-alias": { 190 | "dev-master": "1.7-dev" 191 | } 192 | }, 193 | "autoload": { 194 | "psr-4": { 195 | "GuzzleHttp\\Psr7\\": "src/" 196 | }, 197 | "files": [ 198 | "src/functions_include.php" 199 | ] 200 | }, 201 | "notification-url": "https://packagist.org/downloads/", 202 | "license": [ 203 | "MIT" 204 | ], 205 | "authors": [ 206 | { 207 | "name": "Michael Dowling", 208 | "email": "mtdowling@gmail.com", 209 | "homepage": "https://github.com/mtdowling" 210 | }, 211 | { 212 | "name": "Tobias Schultze", 213 | "homepage": "https://github.com/Tobion" 214 | } 215 | ], 216 | "description": "PSR-7 message implementation that also provides common utility methods", 217 | "keywords": [ 218 | "http", 219 | "message", 220 | "psr-7", 221 | "request", 222 | "response", 223 | "stream", 224 | "uri", 225 | "url" 226 | ], 227 | "time": "2020-09-30T07:37:11+00:00" 228 | }, 229 | { 230 | "name": "psr/http-client", 231 | "version": "1.0.1", 232 | "source": { 233 | "type": "git", 234 | "url": "https://github.com/php-fig/http-client.git", 235 | "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" 236 | }, 237 | "dist": { 238 | "type": "zip", 239 | "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", 240 | "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", 241 | "shasum": "" 242 | }, 243 | "require": { 244 | "php": "^7.0 || ^8.0", 245 | "psr/http-message": "^1.0" 246 | }, 247 | "type": "library", 248 | "extra": { 249 | "branch-alias": { 250 | "dev-master": "1.0.x-dev" 251 | } 252 | }, 253 | "autoload": { 254 | "psr-4": { 255 | "Psr\\Http\\Client\\": "src/" 256 | } 257 | }, 258 | "notification-url": "https://packagist.org/downloads/", 259 | "license": [ 260 | "MIT" 261 | ], 262 | "authors": [ 263 | { 264 | "name": "PHP-FIG", 265 | "homepage": "http://www.php-fig.org/" 266 | } 267 | ], 268 | "description": "Common interface for HTTP clients", 269 | "homepage": "https://github.com/php-fig/http-client", 270 | "keywords": [ 271 | "http", 272 | "http-client", 273 | "psr", 274 | "psr-18" 275 | ], 276 | "time": "2020-06-29T06:28:15+00:00" 277 | }, 278 | { 279 | "name": "psr/http-message", 280 | "version": "1.0.1", 281 | "source": { 282 | "type": "git", 283 | "url": "https://github.com/php-fig/http-message.git", 284 | "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" 285 | }, 286 | "dist": { 287 | "type": "zip", 288 | "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", 289 | "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", 290 | "shasum": "" 291 | }, 292 | "require": { 293 | "php": ">=5.3.0" 294 | }, 295 | "type": "library", 296 | "extra": { 297 | "branch-alias": { 298 | "dev-master": "1.0.x-dev" 299 | } 300 | }, 301 | "autoload": { 302 | "psr-4": { 303 | "Psr\\Http\\Message\\": "src/" 304 | } 305 | }, 306 | "notification-url": "https://packagist.org/downloads/", 307 | "license": [ 308 | "MIT" 309 | ], 310 | "authors": [ 311 | { 312 | "name": "PHP-FIG", 313 | "homepage": "http://www.php-fig.org/" 314 | } 315 | ], 316 | "description": "Common interface for HTTP messages", 317 | "homepage": "https://github.com/php-fig/http-message", 318 | "keywords": [ 319 | "http", 320 | "http-message", 321 | "psr", 322 | "psr-7", 323 | "request", 324 | "response" 325 | ], 326 | "time": "2016-08-06T14:39:51+00:00" 327 | }, 328 | { 329 | "name": "ralouphie/getallheaders", 330 | "version": "3.0.3", 331 | "source": { 332 | "type": "git", 333 | "url": "https://github.com/ralouphie/getallheaders.git", 334 | "reference": "120b605dfeb996808c31b6477290a714d356e822" 335 | }, 336 | "dist": { 337 | "type": "zip", 338 | "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", 339 | "reference": "120b605dfeb996808c31b6477290a714d356e822", 340 | "shasum": "" 341 | }, 342 | "require": { 343 | "php": ">=5.6" 344 | }, 345 | "require-dev": { 346 | "php-coveralls/php-coveralls": "^2.1", 347 | "phpunit/phpunit": "^5 || ^6.5" 348 | }, 349 | "type": "library", 350 | "autoload": { 351 | "files": [ 352 | "src/getallheaders.php" 353 | ] 354 | }, 355 | "notification-url": "https://packagist.org/downloads/", 356 | "license": [ 357 | "MIT" 358 | ], 359 | "authors": [ 360 | { 361 | "name": "Ralph Khattar", 362 | "email": "ralph.khattar@gmail.com" 363 | } 364 | ], 365 | "description": "A polyfill for getallheaders.", 366 | "time": "2019-03-08T08:55:37+00:00" 367 | } 368 | ], 369 | "packages-dev": [], 370 | "aliases": [], 371 | "minimum-stability": "stable", 372 | "stability-flags": [], 373 | "prefer-stable": false, 374 | "prefer-lowest": false, 375 | "platform": { 376 | "php": ">=7.0.0" 377 | }, 378 | "platform-dev": [], 379 | "plugin-api-version": "1.1.0" 380 | } 381 | -------------------------------------------------------------------------------- /examples/example.php: -------------------------------------------------------------------------------- 1 | 'https://api.elasticemail.com/v2/', 13 | 'apiKey' => 'yourApiKey' 14 | ]); 15 | 16 | $client = new \ElasticEmailClient\ElasticClient($configuration); 17 | 18 | $clientData = $client->Account->Load(); -------------------------------------------------------------------------------- /src/ElasticEmailApi/AccessToken.php: -------------------------------------------------------------------------------- 1 | sendRequest('accesstoken/add', array( 19 | 'tokenName' => $tokenName, 20 | 'accessLevel' => $accessLevel)); 21 | } 22 | 23 | /** 24 | * Permanently delete AccessToken from your Account. 25 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 26 | * @param string $tokenName Name of the AccessToken for ease of reference. 27 | */ 28 | public function EEDelete($tokenName) { 29 | return $this->sendRequest('accesstoken/delete', array( 30 | 'tokenName' => $tokenName)); 31 | } 32 | 33 | /** 34 | * List all the AccessToken's in your Account. 35 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 36 | * @return Array<\ElasticEmailEnums\AccessToken> 37 | */ 38 | public function EEList() { 39 | return $this->sendRequest('accesstoken/list', array()); 40 | } 41 | 42 | /** 43 | * Update AccessToken with a new name or AccessLevel. 44 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 45 | * @param string $tokenName Name of the AccessToken for ease of reference. 46 | * @param \ElasticEmailEnums\AccessLevel $accessLevel Level of access (permission) to our API. 47 | * @param string $newTokenName New name of the AccessToken. 48 | */ 49 | public function Update($tokenName, $accessLevel, $newTokenName = null) { 50 | return $this->sendRequest('accesstoken/update', array( 51 | 'tokenName' => $tokenName, 52 | 'accessLevel' => $accessLevel, 53 | 'newTokenName' => $newTokenName)); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Campaign.php: -------------------------------------------------------------------------------- 1 | sendRequest('campaign/add', array( 18 | 'campaign' => $campaign)); 19 | } 20 | 21 | /** 22 | * Makes a copy of a campaign configuration and leaves it in draft mode for further editing. 23 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 24 | * @param int $channelID ID number of selected Channel. 25 | * @param string $newCampaignName 26 | * @return int 27 | */ 28 | public function EECopy($channelID, $newCampaignName = null) { 29 | return $this->sendRequest('campaign/copy', array( 30 | 'channelID' => $channelID, 31 | 'newCampaignName' => $newCampaignName)); 32 | } 33 | 34 | /** 35 | * Deletes the Campaign. This will not cancel emails that are in progress, see /log/cancelinprogress for this option. 36 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 37 | * @param int $channelID ID number of selected Channel. 38 | */ 39 | public function EEDelete($channelID) { 40 | return $this->sendRequest('campaign/delete', array( 41 | 'channelID' => $channelID)); 42 | } 43 | 44 | /** 45 | * Export Campaign data to the chosen file format. 46 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 47 | * @param array $channelIDs List of campaign IDs used for processing 48 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 49 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 50 | * @param string $fileName Name of your file including extension. 51 | * @return \ElasticEmailEnums\ExportLink 52 | */ 53 | public function Export(array $channelIDs = array(), $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null) { 54 | return $this->sendRequest('campaign/export', array( 55 | 'channelIDs' => (count($channelIDs) === 0) ? null : join(';', $channelIDs), 56 | 'fileFormat' => $fileFormat, 57 | 'compressionFormat' => $compressionFormat, 58 | 'fileName' => $fileName)); 59 | } 60 | 61 | /** 62 | * Returns a list all of your Campaigns. 63 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 64 | * @param string $search Text fragment used for searching. 65 | * @param int $offset How many items should be returned ahead. 66 | * @param int $limit Maximum number of returned items. 67 | * @return Array<\ElasticEmailEnums\CampaignChannel> 68 | */ 69 | public function EEList($search = null, $offset = 0, $limit = 0) { 70 | return $this->sendRequest('campaign/list', array( 71 | 'search' => $search, 72 | 'offset' => $offset, 73 | 'limit' => $limit)); 74 | } 75 | 76 | /** 77 | * Updates a previously added Campaign. Only Active and Paused campaigns can be updated. 78 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 79 | * @param \ElasticEmailEnums\Campaign $campaign JSON representation of a campaign 80 | * @return int 81 | */ 82 | public function Update($campaign) { 83 | return $this->sendRequest('campaign/update', array( 84 | 'campaign' => $campaign)); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Channel.php: -------------------------------------------------------------------------------- 1 | sendRequest('channel/add', array( 18 | 'name' => $name)); 19 | } 20 | 21 | /** 22 | * Delete the selected Channel. 23 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 24 | * @param string $name The name of the Channel to delete. 25 | */ 26 | public function EEDelete($name) { 27 | return $this->sendRequest('channel/delete', array( 28 | 'name' => $name)); 29 | } 30 | 31 | /** 32 | * Export selected Channels to chosen file format. 33 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 34 | * @param array $channelNames List of channel names used for processing 35 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 36 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 37 | * @param string $fileName Name of your file including extension. 38 | * @return \ElasticEmailEnums\ExportLink 39 | */ 40 | public function Export($channelNames, $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null) { 41 | return $this->sendRequest('channel/export', array( 42 | 'channelNames' => (count($channelNames) === 0) ? null : join(';', $channelNames), 43 | 'fileFormat' => $fileFormat, 44 | 'compressionFormat' => $compressionFormat, 45 | 'fileName' => $fileName)); 46 | } 47 | 48 | /** 49 | * Returns a list your Channels. 50 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 51 | * @param int $limit Maximum number of returned items. 52 | * @param int $offset How many items should be returned ahead. 53 | * @return Array<\ElasticEmailEnums\Channel> 54 | */ 55 | public function EEList($limit = 0, $offset = 0) { 56 | return $this->sendRequest('channel/list', array( 57 | 'limit' => $limit, 58 | 'offset' => $offset)); 59 | } 60 | 61 | /** 62 | * Rename an existing Channel. 63 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 64 | * @param string $name The name of the Channel to update. 65 | * @param string $newName The new name for the Channel. 66 | * @return string 67 | */ 68 | public function Update($name, $newName) { 69 | return $this->sendRequest('channel/update', array( 70 | 'name' => $name, 71 | 'newName' => $newName)); 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Domain.php: -------------------------------------------------------------------------------- 1 | sendRequest('domain/add', array( 19 | 'domain' => $domain, 20 | 'trackingType' => $trackingType, 21 | 'setAsDefault' => $setAsDefault)); 22 | } 23 | 24 | /** 25 | * Deletes a domain from the Account. 26 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 27 | * @param string $domain Name of selected domain. 28 | */ 29 | public function EEDelete($domain) { 30 | return $this->sendRequest('domain/delete', array( 31 | 'domain' => $domain)); 32 | } 33 | 34 | /** 35 | * Lists all the domains configured for this Account. 36 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 37 | * @return Array<\ElasticEmailEnums\DomainDetail> 38 | */ 39 | public function EEList() { 40 | return $this->sendRequest('domain/list', array()); 41 | } 42 | 43 | /** 44 | * Sets the default sender for the Account as an email address from a verified domain. 45 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 46 | * @param string $email Email address of a verified domain to be used as default when sending from non-verified domains. 47 | */ 48 | public function SetDefault($email) { 49 | return $this->sendRequest('domain/setdefault', array( 50 | 'email' => $email)); 51 | } 52 | 53 | /** 54 | * Allow to use VERP on given domain and specify custom bounces domain. 55 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 56 | * @param string $domain Name of selected domain. 57 | * @param bool $isVerp 58 | * @param string $customBouncesDomain 59 | * @param bool $isCustomBouncesDomainDefault 60 | */ 61 | public function SetVerp($domain, $isVerp, $customBouncesDomain = null, $isCustomBouncesDomainDefault = false) { 62 | return $this->sendRequest('domain/setverp', array( 63 | 'domain' => $domain, 64 | 'isVerp' => $isVerp, 65 | 'customBouncesDomain' => $customBouncesDomain, 66 | 'isCustomBouncesDomainDefault' => $isCustomBouncesDomainDefault)); 67 | } 68 | 69 | /** 70 | * Verifies proper DKIM DNS configuration for the domain. 71 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 72 | * @param string $domain Domain name to verify. 73 | * @return string 74 | */ 75 | public function VerifyDkim($domain) { 76 | return $this->sendRequest('domain/verifydkim', array( 77 | 'domain' => $domain)); 78 | } 79 | 80 | /** 81 | * Verifies proper MX DNS configuration for the domain. 82 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 83 | * @param string $domain Domain name to verify. 84 | * @return string 85 | */ 86 | public function VerifyMX($domain) { 87 | return $this->sendRequest('domain/verifymx', array( 88 | 'domain' => $domain)); 89 | } 90 | 91 | /** 92 | * Verifies proper SPF DNS configuration for the domain. 93 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 94 | * @param string $domain Domain name to verifiy. 95 | * @return \ElasticEmailEnums\ValidationStatus 96 | */ 97 | public function VerifySpf($domain) { 98 | return $this->sendRequest('domain/verifyspf', array( 99 | 'domain' => $domain)); 100 | } 101 | 102 | /** 103 | * Verifies proper CNAME DNS configuration for the tracking domain. 104 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 105 | * @param string $domain Domain name to verify. 106 | * @param \ElasticEmailEnums\TrackingType $trackingType 107 | * @return string 108 | */ 109 | public function VerifyTracking($domain, $trackingType = \ElasticEmailEnums\TrackingType::Http) { 110 | return $this->sendRequest('domain/verifytracking', array( 111 | 'domain' => $domain, 112 | 'trackingType' => $trackingType)); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/EEList.php: -------------------------------------------------------------------------------- 1 | $emails Comma delimited list of contact emails 18 | * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false 19 | * @return int 20 | */ 21 | public function Add($listName, $createEmptyList = false, $allowUnsubscribe = false, $rule = null, array $emails = array(), $allContacts = false) { 22 | return $this->sendRequest('list/add', array( 23 | 'listName' => $listName, 24 | 'createEmptyList' => $createEmptyList, 25 | 'allowUnsubscribe' => $allowUnsubscribe, 26 | 'rule' => $rule, 27 | 'emails' => (count($emails) === 0) ? null : join(';', $emails), 28 | 'allContacts' => $allContacts)); 29 | } 30 | 31 | /** 32 | * Add existing Contacts to chosen list 33 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 34 | * @param string $listName Name of your list. 35 | * @param string $rule Query used for filtering. 36 | * @param array $emails Comma delimited list of contact emails 37 | * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false 38 | */ 39 | public function AddContacts($listName, $rule = null, array $emails = array(), $allContacts = false) { 40 | return $this->sendRequest('list/addcontacts', array( 41 | 'listName' => $listName, 42 | 'rule' => $rule, 43 | 'emails' => (count($emails) === 0) ? null : join(';', $emails), 44 | 'allContacts' => $allContacts)); 45 | } 46 | 47 | /** 48 | * Copy your existing List with the option to provide new settings to it. Some fields, when left empty, default to the source list's settings 49 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 50 | * @param string $sourceListName The name of the list you want to copy 51 | * @param string $newlistName Name of your list if you want to change it. 52 | * @param ?bool $createEmptyList True to create an empty list, otherwise false. Ignores rule and emails parameters if provided. 53 | * @param ?bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false 54 | * @param string $rule Query used for filtering. 55 | * @return int 56 | */ 57 | public function EECopy($sourceListName, $newlistName = null, $createEmptyList = null, $allowUnsubscribe = null, $rule = null) { 58 | return $this->sendRequest('list/copy', array( 59 | 'sourceListName' => $sourceListName, 60 | 'newlistName' => $newlistName, 61 | 'createEmptyList' => $createEmptyList, 62 | 'allowUnsubscribe' => $allowUnsubscribe, 63 | 'rule' => $rule)); 64 | } 65 | 66 | /** 67 | * Create a new list from the recipients of the given campaign, using the given statuses of Messages 68 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 69 | * @param int $campaignID ID of the campaign which recipients you want to copy 70 | * @param string $listName Name of your list. 71 | * @param array<\ElasticEmailEnums\LogJobStatus> $statuses Statuses of a campaign's emails you want to include in the new list (but NOT the contacts' statuses) 72 | */ 73 | public function CreateFromCampaign($campaignID, $listName, array $statuses = array()) { 74 | return $this->sendRequest('list/createfromcampaign', array( 75 | 'campaignID' => $campaignID, 76 | 'listName' => $listName, 77 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses))); 78 | } 79 | 80 | /** 81 | * Create a series of nth selection lists from an existing list or segment 82 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 83 | * @param string $listName Name of your list. 84 | * @param int $numberOfLists The number of evenly distributed lists to create. 85 | * @param bool $excludeBlocked True if you want to exclude contacts that are currently in a blocked status of either unsubscribe, complaint or bounce. Otherwise, false. 86 | * @param bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false 87 | * @param string $rule Query used for filtering. 88 | * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false 89 | */ 90 | public function CreateNthSelectionLists($listName, $numberOfLists, $excludeBlocked = true, $allowUnsubscribe = false, $rule = null, $allContacts = false) { 91 | return $this->sendRequest('list/createnthselectionlists', array( 92 | 'listName' => $listName, 93 | 'numberOfLists' => $numberOfLists, 94 | 'excludeBlocked' => $excludeBlocked, 95 | 'allowUnsubscribe' => $allowUnsubscribe, 96 | 'rule' => $rule, 97 | 'allContacts' => $allContacts)); 98 | } 99 | 100 | /** 101 | * Create a new list with randomized contacts from an existing list or segment 102 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 103 | * @param string $listName Name of your list. 104 | * @param int $count Number of items. 105 | * @param bool $excludeBlocked True if you want to exclude contacts that are currently in a blocked status of either unsubscribe, complaint or bounce. Otherwise, false. 106 | * @param bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false 107 | * @param string $rule Query used for filtering. 108 | * @param bool $allContacts True: Include every Contact in your Account. Otherwise, false 109 | * @return int 110 | */ 111 | public function CreateRandomList($listName, $count, $excludeBlocked = true, $allowUnsubscribe = false, $rule = null, $allContacts = false) { 112 | return $this->sendRequest('list/createrandomlist', array( 113 | 'listName' => $listName, 114 | 'count' => $count, 115 | 'excludeBlocked' => $excludeBlocked, 116 | 'allowUnsubscribe' => $allowUnsubscribe, 117 | 'rule' => $rule, 118 | 'allContacts' => $allContacts)); 119 | } 120 | 121 | /** 122 | * Deletes List and removes all the Contacts from it (does not delete Contacts). 123 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 124 | * @param string $listName Name of your list. 125 | */ 126 | public function EEDelete($listName) { 127 | return $this->sendRequest('list/delete', array( 128 | 'listName' => $listName)); 129 | } 130 | 131 | /** 132 | * Exports all the contacts from the provided list 133 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 134 | * @param string $listName Name of your list. 135 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 136 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 137 | * @param string $fileName Name of your file including extension. 138 | * @return \ElasticEmailEnums\ExportLink 139 | */ 140 | public function Export($listName, $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null) { 141 | return $this->sendRequest('list/export', array( 142 | 'listName' => $listName, 143 | 'fileFormat' => $fileFormat, 144 | 'compressionFormat' => $compressionFormat, 145 | 'fileName' => $fileName)); 146 | } 147 | 148 | /** 149 | * Shows all your existing lists 150 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 151 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 152 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 153 | * @return Array<\ElasticEmailEnums\List> 154 | */ 155 | public function EElist($from = null, $to = null) { 156 | return $this->sendRequest('list/list', array( 157 | 'from' => $from, 158 | 'to' => $to)); 159 | } 160 | 161 | /** 162 | * Returns detailed information about specific list. 163 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 164 | * @param string $listName Name of your list. 165 | * @return \ElasticEmailEnums\List 166 | */ 167 | public function Load($listName) { 168 | return $this->sendRequest('list/load', array( 169 | 'listName' => $listName)); 170 | } 171 | 172 | /** 173 | * Move selected contacts from one List to another 174 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 175 | * @param string $oldListName The name of the list from which the contacts will be copied from 176 | * @param string $newListName The name of the list to copy the contacts to 177 | * @param array $emails Comma delimited list of contact emails 178 | * @param ?bool $moveAll TRUE - moves all contacts; FALSE - moves contacts provided in the 'emails' parameter. This is ignored if the 'statuses' parameter has been provided 179 | * @param array<\ElasticEmailEnums\ContactStatus> $statuses List of contact statuses which are eligible to move. This ignores the 'moveAll' parameter 180 | * @param string $rule Query used for filtering. 181 | */ 182 | public function MoveContacts($oldListName, $newListName, array $emails = array(), $moveAll = null, array $statuses = array(), $rule = null) { 183 | return $this->sendRequest('list/movecontacts', array( 184 | 'oldListName' => $oldListName, 185 | 'newListName' => $newListName, 186 | 'emails' => (count($emails) === 0) ? null : join(';', $emails), 187 | 'moveAll' => $moveAll, 188 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), 189 | 'rule' => $rule)); 190 | } 191 | 192 | /** 193 | * Remove selected Contacts from your list 194 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 195 | * @param string $listName Name of your list. 196 | * @param string $rule Query used for filtering. 197 | * @param array $emails Comma delimited list of contact emails 198 | */ 199 | public function RemoveContacts($listName, $rule = null, array $emails = array()) { 200 | return $this->sendRequest('list/removecontacts', array( 201 | 'listName' => $listName, 202 | 'rule' => $rule, 203 | 'emails' => (count($emails) === 0) ? null : join(';', $emails))); 204 | } 205 | 206 | /** 207 | * Update existing list 208 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 209 | * @param string $listName Name of your list. 210 | * @param string $newListName Name of your list if you want to change it. 211 | * @param bool $allowUnsubscribe True: Allow unsubscribing from this list. Otherwise, false 212 | */ 213 | public function Update($listName, $newListName = null, $allowUnsubscribe = false) { 214 | return $this->sendRequest('list/update', array( 215 | 'listName' => $listName, 216 | 'newListName' => $newListName, 217 | 'allowUnsubscribe' => $allowUnsubscribe)); 218 | } 219 | 220 | } 221 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Email.php: -------------------------------------------------------------------------------- 1 | sendRequest('email/getstatus', array( 28 | 'transactionID' => $transactionID, 29 | 'showFailed' => $showFailed, 30 | 'showSent' => $showSent, 31 | 'showDelivered' => $showDelivered, 32 | 'showPending' => $showPending, 33 | 'showOpened' => $showOpened, 34 | 'showClicked' => $showClicked, 35 | 'showAbuse' => $showAbuse, 36 | 'showUnsubscribed' => $showUnsubscribed, 37 | 'showErrors' => $showErrors, 38 | 'showMessageIDs' => $showMessageIDs)); 39 | } 40 | 41 | /** 42 | * Lists the file attachments for the specified email. 43 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 44 | * @param string $msgID ID number of selected message. 45 | * @return Array<\ElasticEmailEnums\File> 46 | */ 47 | public function ListAttachments($msgID) { 48 | return $this->sendRequest('email/listattachments', array( 49 | 'msgID' => $msgID)); 50 | } 51 | 52 | /** 53 | * Submit emails. The HTTP POST request is suggested. The default, maximum (accepted by us) size of an email is 10 MB in total, with or without attachments included. For suggested implementations please refer to https://elasticemail.com/support/http-api/ 54 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 55 | * @param string $subject Email subject 56 | * @param string $from From email address 57 | * @param string $fromName Display name for from email address 58 | * @param string $sender Email address of the sender 59 | * @param string $senderName Display name sender 60 | * @param string $msgFrom Optional parameter. Sets FROM MIME header. 61 | * @param string $msgFromName Optional parameter. Sets FROM name of MIME header. 62 | * @param string $replyTo Email address to reply to 63 | * @param string $replyToName Display name of the reply to address 64 | * @param array $to List of email recipients (each email is treated separately, like a BCC). Separated by comma or semicolon. We suggest using the "msgTo" parameter if backward compatibility with API version 1 is not a must. 65 | * @param array $msgTo Optional parameter. Will be ignored if the 'to' parameter is also provided. List of email recipients (visible to all other recipients of the message as TO MIME header). Separated by comma or semicolon. 66 | * @param array $msgCC Optional parameter. Will be ignored if the 'to' parameter is also provided. List of email recipients (visible to all other recipients of the message as CC MIME header). Separated by comma or semicolon. 67 | * @param array $msgBcc Optional parameter. Will be ignored if the 'to' parameter is also provided. List of email recipients (each email is treated seperately). Separated by comma or semicolon. 68 | * @param array $lists The name of a contact list you would like to send to. Separate multiple contact lists by commas or semicolons. 69 | * @param array $segments The name of a segment you would like to send to. Separate multiple segments by comma or semicolon. Insert "0" for all Active contacts. 70 | * @param string $mergeSourceFilename File name one of attachments which is a CSV list of Recipients. 71 | * @param string $dataSource Name or ID of the previously uploaded file (via the File/Upload request) which should be a CSV list of Recipients. 72 | * @param string $channel An ID field (max 191 chars) that can be used for reporting [will default to HTTP API or SMTP API] 73 | * @param string $bodyHtml Html email body 74 | * @param string $bodyText Text email body 75 | * @param string $charset Text value of charset encoding for example: iso-8859-1, windows-1251, utf-8, us-ascii, windows-1250 and more… 76 | * @param string $charsetBodyHtml Sets charset for body html MIME part (overrides default value from charset parameter) 77 | * @param string $charsetBodyText Sets charset for body text MIME part (overrides default value from charset parameter) 78 | * @param \ElasticEmailEnums\EncodingType $encodingType 0 for None, 1 for Raw7Bit, 2 for Raw8Bit, 3 for QuotedPrintable, 4 for Base64 (Default), 5 for Uue note that you can also provide the text version such as "Raw7Bit" for value 1. NOTE: Base64 or QuotedPrintable is recommended if you are validating your domain(s) with DKIM. 79 | * @param string $template The ID of an email template you have created in your account. 80 | * @param array $attachmentFiles Attachment files. These files should be provided with the POST multipart file upload and not directly in the request's URL. Can also include merge CSV file 81 | * @param array $headers Optional Custom Headers. Request parameters prefixed by headers_ like headers_customheader1, headers_customheader2. Note: a space is required after the colon before the custom header value. headers_xmailer=xmailer: header-value1 82 | * @param string $postBack Optional header returned in notifications. 83 | * @param array $merge Request parameters prefixed by merge_ like merge_firstname, merge_lastname. If sending to a template you can send merge_ fields to merge data with the template. Template fields are entered with {firstname}, {lastname} etc. 84 | * @param string $timeOffSetMinutes Number of minutes in the future this email should be sent up to a maximum of 1 year (524160 minutes) 85 | * @param string $poolName Name of your custom IP Pool to be used in the sending process 86 | * @param bool $isTransactional True, if email is transactional (non-bulk, non-marketing, non-commercial). Otherwise, false 87 | * @param array $attachments Names or IDs of attachments previously uploaded to your account (via the File/Upload request) that should be sent with this e-mail. 88 | * @param ?bool $trackOpens Should the opens be tracked? If no value has been provided, Account's default setting will be used. 89 | * @param ?bool $trackClicks Should the clicks be tracked? If no value has been provided, Account's default setting will be used. 90 | * @param string $utmSource The utm_source marketing parameter appended to each link in the campaign. 91 | * @param string $utmMedium The utm_medium marketing parameter appended to each link in the campaign. 92 | * @param string $utmCampaign The utm_campaign marketing parameter appended to each link in the campaign. 93 | * @param string $utmContent The utm_content marketing parameter appended to each link in the campaign. 94 | * @param string $bodyAmp AMP email body 95 | * @param string $charsetBodyAmp Sets charset for body AMP MIME part (overrides default value from charset parameter) 96 | * @return \ElasticEmailEnums\EmailSend 97 | */ 98 | public function Send($subject = null, $from = null, $fromName = null, $sender = null, $senderName = null, $msgFrom = null, $msgFromName = null, $replyTo = null, $replyToName = null, array $to = array(), array $msgTo = array(), array $msgCC = array(), array $msgBcc = array(), array $lists = array(), array $segments = array(), $mergeSourceFilename = null, $dataSource = null, $channel = null, $bodyHtml = null, $bodyText = null, $charset = null, $charsetBodyHtml = null, $charsetBodyText = null, $encodingType = \ElasticEmailEnums\EncodingType::None, $template = null, array $attachmentFiles = array(), array $headers = array(), $postBack = null, array $merge = array(), $timeOffSetMinutes = null, $poolName = null, $isTransactional = false, array $attachments = array(), $trackOpens = null, $trackClicks = null, $utmSource = null, $utmMedium = null, $utmCampaign = null, $utmContent = null, $bodyAmp = null, $charsetBodyAmp = null) { 99 | $arr = array( 100 | 'subject' => $subject, 101 | 'from' => $from, 102 | 'fromName' => $fromName, 103 | 'sender' => $sender, 104 | 'senderName' => $senderName, 105 | 'msgFrom' => $msgFrom, 106 | 'msgFromName' => $msgFromName, 107 | 'replyTo' => $replyTo, 108 | 'replyToName' => $replyToName, 109 | 'to' => (count($to) === 0) ? null : join(';', $to), 110 | 'msgTo' => (count($msgTo) === 0) ? null : join(';', $msgTo), 111 | 'msgCC' => (count($msgCC) === 0) ? null : join(';', $msgCC), 112 | 'msgBcc' => (count($msgBcc) === 0) ? null : join(';', $msgBcc), 113 | 'lists' => (count($lists) === 0) ? null : join(';', $lists), 114 | 'segments' => (count($segments) === 0) ? null : join(';', $segments), 115 | 'mergeSourceFilename' => $mergeSourceFilename, 116 | 'dataSource' => $dataSource, 117 | 'channel' => $channel, 118 | 'bodyHtml' => $bodyHtml, 119 | 'bodyText' => $bodyText, 120 | 'charset' => $charset, 121 | 'charsetBodyHtml' => $charsetBodyHtml, 122 | 'charsetBodyText' => $charsetBodyText, 123 | 'encodingType' => $encodingType, 124 | 'template' => $template, 125 | 'postBack' => $postBack, 126 | 'timeOffSetMinutes' => $timeOffSetMinutes, 127 | 'poolName' => $poolName, 128 | 'isTransactional' => $isTransactional, 129 | 'attachments' => (count($attachments) === 0) ? null : join(';', $attachments), 130 | 'trackOpens' => $trackOpens, 131 | 'trackClicks' => $trackClicks, 132 | 'utmSource' => $utmSource, 133 | 'utmMedium' => $utmMedium, 134 | 'utmCampaign' => $utmCampaign, 135 | 'utmContent' => $utmContent, 136 | 'bodyAmp' => $bodyAmp, 137 | 'charsetBodyAmp' => $charsetBodyAmp); 138 | foreach(array_keys($headers) as $key) { 139 | $arr['headers_'.$key] = $key.': '.$headers[$key]; 140 | } 141 | foreach(array_keys($merge) as $key) { 142 | $arr['merge_'.$key] = $merge[$key]; 143 | } 144 | return $this->sendRequest('email/send', $arr, "POST", $attachmentFiles); 145 | } 146 | 147 | /** 148 | * Detailed status of a unique email sent through your account. Returns a 'Email has expired and the status is unknown.' error, if the email has not been fully processed yet. 149 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 150 | * @param string $messageID Unique identifier for this email. 151 | * @return \ElasticEmailEnums\EmailStatus 152 | */ 153 | public function Status($messageID) { 154 | return $this->sendRequest('email/status', array( 155 | 'messageID' => $messageID)); 156 | } 157 | 158 | /** 159 | * Checks if verification emails is completed. 160 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 161 | * @param Guid $txID 162 | * @return \ElasticEmailEnums\Export 163 | */ 164 | public function VerificationResult($txID) { 165 | return $this->sendRequest('email/verificationresult', array( 166 | 'txID' => $txID)); 167 | } 168 | 169 | /** 170 | * Verify single email address 171 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 172 | * @param string $email Proper email address. 173 | * @param bool $uploadContact 174 | * @param bool $updateStatus Should the existing contact's status be changed automatically based on the validation result 175 | * @return \ElasticEmailEnums\EmailValidationResult 176 | */ 177 | public function Verify($email, $uploadContact = false, $updateStatus = false) { 178 | return $this->sendRequest('email/verify', array( 179 | 'email' => $email, 180 | 'uploadContact' => $uploadContact, 181 | 'updateStatus' => $updateStatus)); 182 | } 183 | 184 | /** 185 | * Verify list of email addresses from file. Each email has to be in new line. This is asynchronous task. To check if task is completed use VerificationResult with returned task ID. 186 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 187 | * @param File $emails Comma delimited list of contact emails 188 | * @param string $rule Query used for filtering. 189 | * @param array $listOfEmails 190 | * @param bool $uploadContacts 191 | * @param bool $updateStatus Should the existing contacts' status be changed automatically based on the validation results 192 | * @return string 193 | */ 194 | public function VerifyList($emails = null, $rule = null, array $listOfEmails = array(), $uploadContacts = false, $updateStatus = false) { 195 | return $this->sendRequest('email/verifylist', array( 196 | 'rule' => $rule, 197 | 'listOfEmails' => (count($listOfEmails) === 0) ? null : join(';', $listOfEmails), 198 | 'uploadContacts' => $uploadContacts, 199 | 'updateStatus' => $updateStatus), "POST", $emails); 200 | } 201 | 202 | /** 203 | * View email 204 | * @param string $messageID Message identifier 205 | * @param bool $enableTracking 206 | * @return \ElasticEmailEnums\EmailView 207 | */ 208 | public function View($messageID, $enableTracking = false) { 209 | return $this->sendRequest('email/view', array( 210 | 'messageID' => $messageID, 211 | 'enableTracking' => $enableTracking)); 212 | } 213 | 214 | } 215 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Export.php: -------------------------------------------------------------------------------- 1 | sendRequest('export/checkstatus', array( 18 | 'publicExportID' => $publicExportID)); 19 | } 20 | 21 | /** 22 | * Delete the specified export. 23 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 24 | * @param Guid $publicExportID ID of the exported file 25 | */ 26 | public function EEDelete($publicExportID) { 27 | return $this->sendRequest('export/delete', array( 28 | 'publicExportID' => $publicExportID)); 29 | } 30 | 31 | /** 32 | * Download the specified export files in one package 33 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 34 | * @param array $publicExportIDs 35 | * @return File 36 | */ 37 | public function DownloadBulk($publicExportIDs) { 38 | return $this->sendRequest('export/downloadbulk', array( 39 | 'publicExportIDs' => (count($publicExportIDs) === 0) ? null : join(';', $publicExportIDs))); 40 | } 41 | 42 | /** 43 | * Returns a list of all exported data. 44 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 45 | * @param int $limit Maximum number of returned items. 46 | * @param int $offset How many items should be returned ahead. 47 | * @return Array<\ElasticEmailEnums\Export> 48 | */ 49 | public function EEList($limit = 0, $offset = 0) { 50 | return $this->sendRequest('export/list', array( 51 | 'limit' => $limit, 52 | 'offset' => $offset)); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/File.php: -------------------------------------------------------------------------------- 1 | sendRequest('file/delete', array( 18 | 'fileID' => $fileID, 19 | 'filename' => $filename)); 20 | } 21 | 22 | /** 23 | * Downloads the file to your local device. 24 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 25 | * @param string $filename Name of your file including extension. 26 | * @param ?int $fileID Unique identifier for the file stored in your Account. 27 | * @return File 28 | */ 29 | public function Download($filename = null, $fileID = null) { 30 | return $this->sendRequest('file/download', array( 31 | 'filename' => $filename, 32 | 'fileID' => $fileID)); 33 | } 34 | 35 | /** 36 | * Lists all your available files. 37 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 38 | * @return Array<\ElasticEmailEnums\File> 39 | */ 40 | public function ListAll() { 41 | return $this->sendRequest('file/listall', array()); 42 | } 43 | 44 | /** 45 | * Returns detailed file information for the given file. 46 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 47 | * @param string $filename Name of your file including extension. 48 | * @return \ElasticEmailEnums\File 49 | */ 50 | public function Load($filename) { 51 | return $this->sendRequest('file/load', array( 52 | 'filename' => $filename)); 53 | } 54 | 55 | /** 56 | * Uploads selected file to your Account using http form upload format (MIME multipart/form-data) or PUT method. 57 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 58 | * @param File $file 59 | * @param string $name Filename 60 | * @param ?int $expiresAfterDays Number of days the file should be stored for. 61 | * @param bool $enforceUniqueFileName If a file exists with the same name do not upload and override the file. 62 | * @return \ElasticEmailEnums\File 63 | */ 64 | public function Upload($file, $name = null, $expiresAfterDays = 35, $enforceUniqueFileName = false) { 65 | return $this->sendRequest('file/upload', array( 66 | 'name' => $name, 67 | 'expiresAfterDays' => $expiresAfterDays, 68 | 'enforceUniqueFileName' => $enforceUniqueFileName), "POST", $file); 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Log.php: -------------------------------------------------------------------------------- 1 | sendRequest('log/cancelinprogress', array( 18 | 'channelName' => $channelName, 19 | 'transactionID' => $transactionID)); 20 | } 21 | 22 | /** 23 | * Returns log of delivery events filtered by specified parameters. 24 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 25 | * @param array<\ElasticEmailEnums\LogEventStatus> $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report 26 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 27 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 28 | * @param string $channelName Name of selected channel. 29 | * @param int $limit Maximum number of returned items. 30 | * @param int $offset How many items should be returned ahead. 31 | * @return \ElasticEmailEnums\EventLog 32 | */ 33 | public function Events(array $statuses = array(), $from = null, $to = null, $channelName = null, $limit = 0, $offset = 0) { 34 | return $this->sendRequest('log/events', array( 35 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), 36 | 'from' => $from, 37 | 'to' => $to, 38 | 'channelName' => $channelName, 39 | 'limit' => $limit, 40 | 'offset' => $offset)); 41 | } 42 | 43 | /** 44 | * Export email log information to the specified file format. 45 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 46 | * @param array<\ElasticEmailEnums\LogJobStatus> $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report 47 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 48 | * @param ?DateTime $from Start date. 49 | * @param ?DateTime $to End date. 50 | * @param string $channelName Name of selected channel. 51 | * @param bool $includeEmail True: Search includes emails. Otherwise, false. 52 | * @param bool $includeSms True: Search includes SMS. Otherwise, false. 53 | * @param array<\ElasticEmailEnums\MessageCategory> $messageCategory ID of message category 54 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 55 | * @param string $fileName Name of your file including extension. 56 | * @param string $email Proper email address. 57 | * @return \ElasticEmailEnums\ExportLink 58 | */ 59 | public function Export($statuses, $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $from = null, $to = null, $channelName = null, $includeEmail = true, $includeSms = true, array $messageCategory = array(), $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null, $email = null) { 60 | return $this->sendRequest('log/export', array( 61 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), 62 | 'fileFormat' => $fileFormat, 63 | 'from' => $from, 64 | 'to' => $to, 65 | 'channelName' => $channelName, 66 | 'includeEmail' => $includeEmail, 67 | 'includeSms' => $includeSms, 68 | 'messageCategory' => (count($messageCategory) === 0) ? null : join(';', $messageCategory), 69 | 'compressionFormat' => $compressionFormat, 70 | 'fileName' => $fileName, 71 | 'email' => $email)); 72 | } 73 | 74 | /** 75 | * Export delivery events log information to the specified file format. 76 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 77 | * @param array<\ElasticEmailEnums\LogEventStatus> $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report 78 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 79 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 80 | * @param string $channelName Name of selected channel. 81 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 82 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 83 | * @param string $fileName Name of your file including extension. 84 | * @return \ElasticEmailEnums\ExportLink 85 | */ 86 | public function ExportEvents(array $statuses = array(), $from = null, $to = null, $channelName = null, $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null) { 87 | return $this->sendRequest('log/exportevents', array( 88 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), 89 | 'from' => $from, 90 | 'to' => $to, 91 | 'channelName' => $channelName, 92 | 'fileFormat' => $fileFormat, 93 | 'compressionFormat' => $compressionFormat, 94 | 'fileName' => $fileName)); 95 | } 96 | 97 | /** 98 | * Export detailed link tracking information to the specified file format. 99 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 100 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 101 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 102 | * @param string $channelName Name of selected channel. 103 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 104 | * @param int $limit Maximum number of returned items. 105 | * @param int $offset How many items should be returned ahead. 106 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 107 | * @param string $fileName Name of your file including extension. 108 | * @return \ElasticEmailEnums\ExportLink 109 | */ 110 | public function ExportLinkTracking($from, $to, $channelName = null, $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $limit = 0, $offset = 0, $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null) { 111 | return $this->sendRequest('log/exportlinktracking', array( 112 | 'from' => $from, 113 | 'to' => $to, 114 | 'channelName' => $channelName, 115 | 'fileFormat' => $fileFormat, 116 | 'limit' => $limit, 117 | 'offset' => $offset, 118 | 'compressionFormat' => $compressionFormat, 119 | 'fileName' => $fileName)); 120 | } 121 | 122 | /** 123 | * Track link clicks 124 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 125 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 126 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 127 | * @param int $limit Maximum number of returned items. 128 | * @param int $offset How many items should be returned ahead. 129 | * @param string $channelName Name of selected channel. 130 | * @return \ElasticEmailEnums\LinkTrackingDetails 131 | */ 132 | public function LinkTracking($from = null, $to = null, $limit = 0, $offset = 0, $channelName = null) { 133 | return $this->sendRequest('log/linktracking', array( 134 | 'from' => $from, 135 | 'to' => $to, 136 | 'limit' => $limit, 137 | 'offset' => $offset, 138 | 'channelName' => $channelName)); 139 | } 140 | 141 | /** 142 | * Returns logs filtered by specified parameters. 143 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 144 | * @param array<\ElasticEmailEnums\LogJobStatus> $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report 145 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 146 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 147 | * @param string $channelName Name of selected channel. 148 | * @param int $limit Maximum number of returned items. 149 | * @param int $offset How many items should be returned ahead. 150 | * @param bool $includeEmail True: Search includes emails. Otherwise, false. 151 | * @param bool $includeSms True: Search includes SMS. Otherwise, false. 152 | * @param array<\ElasticEmailEnums\MessageCategory> $messageCategory ID of message category 153 | * @param string $email Proper email address. 154 | * @param string $ipaddress Search for recipients that we sent through this IP address 155 | * @return \ElasticEmailEnums\Log 156 | */ 157 | public function Load($statuses, $from = null, $to = null, $channelName = null, $limit = 0, $offset = 0, $includeEmail = true, $includeSms = true, array $messageCategory = array(), $email = null, $ipaddress = null) { 158 | return $this->sendRequest('log/load', array( 159 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), 160 | 'from' => $from, 161 | 'to' => $to, 162 | 'channelName' => $channelName, 163 | 'limit' => $limit, 164 | 'offset' => $offset, 165 | 'includeEmail' => $includeEmail, 166 | 'includeSms' => $includeSms, 167 | 'messageCategory' => (count($messageCategory) === 0) ? null : join(';', $messageCategory), 168 | 'email' => $email, 169 | 'ipaddress' => $ipaddress)); 170 | } 171 | 172 | /** 173 | * Returns notification logs filtered by specified parameters. 174 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 175 | * @param array<\ElasticEmailEnums\LogJobStatus> $statuses List of comma separated message statuses: 0 for all, 1 for ReadyToSend, 2 for InProgress, 4 for Bounced, 5 for Sent, 6 for Opened, 7 for Clicked, 8 for Unsubscribed, 9 for Abuse Report 176 | * @param ?DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 177 | * @param ?DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 178 | * @param int $limit Maximum number of returned items. 179 | * @param int $offset How many items should be returned ahead. 180 | * @param array<\ElasticEmailEnums\MessageCategory> $messageCategory ID of message category 181 | * @param bool $useStatusChangeDate True, if 'from' and 'to' parameters should resolve to the Status Change date. To resolve to the creation date - false 182 | * @param \ElasticEmailEnums\NotificationType $notificationType 183 | * @return \ElasticEmailEnums\Log 184 | */ 185 | public function LoadNotifications($statuses, $from = null, $to = null, $limit = 0, $offset = 0, array $messageCategory = array(), $useStatusChangeDate = false, $notificationType = \ElasticEmailEnums\NotificationType::All) { 186 | return $this->sendRequest('log/loadnotifications', array( 187 | 'statuses' => (count($statuses) === 0) ? null : join(';', $statuses), 188 | 'from' => $from, 189 | 'to' => $to, 190 | 'limit' => $limit, 191 | 'offset' => $offset, 192 | 'messageCategory' => (count($messageCategory) === 0) ? null : join(';', $messageCategory), 193 | 'useStatusChangeDate' => $useStatusChangeDate, 194 | 'notificationType' => $notificationType)); 195 | } 196 | 197 | /** 198 | * Loads summary information about activity in chosen date range. 199 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 200 | * @param DateTime $from Starting date for search in YYYY-MM-DDThh:mm:ss format. 201 | * @param DateTime $to Ending date for search in YYYY-MM-DDThh:mm:ss format. 202 | * @param string $channelName Name of selected channel. 203 | * @param \ElasticEmailEnums\IntervalType $interval 'Hourly' for detailed information, 'summary' for daily overview 204 | * @param string $transactionID ID number of transaction 205 | * @return \ElasticEmailEnums\LogSummary 206 | */ 207 | public function Summary($from, $to, $channelName = null, $interval = \ElasticEmailEnums\IntervalType::Summary, $transactionID = null) { 208 | return $this->sendRequest('log/summary', array( 209 | 'from' => $from, 210 | 'to' => $to, 211 | 'channelName' => $channelName, 212 | 'interval' => $interval, 213 | 'transactionID' => $transactionID)); 214 | } 215 | 216 | } 217 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/SMS.php: -------------------------------------------------------------------------------- 1 | sendRequest('sms/send', array( 18 | 'to' => $to, 19 | 'body' => $body)); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Segment.php: -------------------------------------------------------------------------------- 1 | sendRequest('segment/add', array( 19 | 'segmentName' => $segmentName, 20 | 'rule' => $rule)); 21 | } 22 | 23 | /** 24 | * Copy your existing Segment with the optional new rule and custom name 25 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 26 | * @param string $sourceSegmentName The name of the segment you want to copy 27 | * @param string $newSegmentName New name of your segment if you want to change it. 28 | * @param string $rule Query used for filtering. 29 | * @return \ElasticEmailEnums\Segment 30 | */ 31 | public function EECopy($sourceSegmentName, $newSegmentName = null, $rule = null) { 32 | return $this->sendRequest('segment/copy', array( 33 | 'sourceSegmentName' => $sourceSegmentName, 34 | 'newSegmentName' => $newSegmentName, 35 | 'rule' => $rule)); 36 | } 37 | 38 | /** 39 | * Delete existing segment. 40 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 41 | * @param string $segmentName Name of your segment. 42 | */ 43 | public function EEDelete($segmentName) { 44 | return $this->sendRequest('segment/delete', array( 45 | 'segmentName' => $segmentName)); 46 | } 47 | 48 | /** 49 | * Exports all the contacts from the provided segment 50 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 51 | * @param string $segmentName Name of your segment. 52 | * @param \ElasticEmailEnums\ExportFileFormats $fileFormat Format of the exported file 53 | * @param \ElasticEmailEnums\CompressionFormat $compressionFormat FileResponse compression format. None or Zip. 54 | * @param string $fileName Name of your file including extension. 55 | * @return \ElasticEmailEnums\ExportLink 56 | */ 57 | public function Export($segmentName, $fileFormat = \ElasticEmailEnums\ExportFileFormats::Csv, $compressionFormat = \ElasticEmailEnums\CompressionFormat::None, $fileName = null) { 58 | return $this->sendRequest('segment/export', array( 59 | 'segmentName' => $segmentName, 60 | 'fileFormat' => $fileFormat, 61 | 'compressionFormat' => $compressionFormat, 62 | 'fileName' => $fileName)); 63 | } 64 | 65 | /** 66 | * Lists all your available Segments 67 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 68 | * @param bool $includeHistory True: Include history of last 30 days. Otherwise, false. 69 | * @param ?DateTime $from From what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. 70 | * @param ?DateTime $to To what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. 71 | * @return Array<\ElasticEmailEnums\Segment> 72 | */ 73 | public function EEList($includeHistory = false, $from = null, $to = null) { 74 | return $this->sendRequest('segment/list', array( 75 | 'includeHistory' => $includeHistory, 76 | 'from' => $from, 77 | 'to' => $to)); 78 | } 79 | 80 | /** 81 | * Lists your available Segments using the provided names 82 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 83 | * @param array $segmentNames Names of segments you want to load. Will load all contacts if left empty or the 'All Contacts' name has been provided 84 | * @param bool $includeHistory True: Include history of last 30 days. Otherwise, false. 85 | * @param ?DateTime $from From what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. 86 | * @param ?DateTime $to To what date should the segment history be shown. In YYYY-MM-DDThh:mm:ss format. 87 | * @return Array<\ElasticEmailEnums\Segment> 88 | */ 89 | public function LoadByName($segmentNames, $includeHistory = false, $from = null, $to = null) { 90 | return $this->sendRequest('segment/loadbyname', array( 91 | 'segmentNames' => (count($segmentNames) === 0) ? null : join(';', $segmentNames), 92 | 'includeHistory' => $includeHistory, 93 | 'from' => $from, 94 | 'to' => $to)); 95 | } 96 | 97 | /** 98 | * Rename or change RULE for your segment 99 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 100 | * @param string $segmentName Name of your segment. 101 | * @param string $newSegmentName New name of your segment if you want to change it. 102 | * @param string $rule Query used for filtering. 103 | * @return \ElasticEmailEnums\Segment 104 | */ 105 | public function Update($segmentName, $newSegmentName = null, $rule = null) { 106 | return $this->sendRequest('segment/update', array( 107 | 'segmentName' => $segmentName, 108 | 'newSegmentName' => $newSegmentName, 109 | 'rule' => $rule)); 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/Template.php: -------------------------------------------------------------------------------- 1 | $tags 23 | * @param string $bodyAmp AMP code of email (needs escaping). 24 | * @return int 25 | */ 26 | public function Add($name, $subject, $fromEmail, $fromName, $templateScope = \ElasticEmailEnums\TemplateScope::EEPrivate, $bodyHtml = null, $bodyText = null, $css = null, $originalTemplateID = 0, array $tags = array(), $bodyAmp = null) { 27 | return $this->sendRequest('template/add', array( 28 | 'name' => $name, 29 | 'subject' => $subject, 30 | 'fromEmail' => $fromEmail, 31 | 'fromName' => $fromName, 32 | 'templateScope' => $templateScope, 33 | 'bodyHtml' => $bodyHtml, 34 | 'bodyText' => $bodyText, 35 | 'css' => $css, 36 | 'originalTemplateID' => $originalTemplateID, 37 | 'tags' => (count($tags) === 0) ? null : join(';', $tags), 38 | 'bodyAmp' => $bodyAmp)); 39 | } 40 | 41 | /** 42 | * Create a new Tag to be used in your Templates 43 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 44 | * @param string $tag Tag's value 45 | * @return \ElasticEmailEnums\TemplateTag 46 | */ 47 | public function AddTag($tag) { 48 | return $this->sendRequest('template/addtag', array( 49 | 'tag' => $tag)); 50 | } 51 | 52 | /** 53 | * Copy Selected Template 54 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 55 | * @param int $templateID ID number of template. 56 | * @param string $name Filename 57 | * @param string $subject Default subject of email. 58 | * @param string $fromEmail Default From: email address. 59 | * @param string $fromName Default From: name. 60 | * @return \ElasticEmailEnums\Template 61 | */ 62 | public function EECopy($templateID, $name, $subject, $fromEmail, $fromName) { 63 | return $this->sendRequest('template/copy', array( 64 | 'templateID' => $templateID, 65 | 'name' => $name, 66 | 'subject' => $subject, 67 | 'fromEmail' => $fromEmail, 68 | 'fromName' => $fromName)); 69 | } 70 | 71 | /** 72 | * Delete template with the specified ID 73 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 74 | * @param int $templateID ID number of template. 75 | */ 76 | public function EEDelete($templateID) { 77 | return $this->sendRequest('template/delete', array( 78 | 'templateID' => $templateID)); 79 | } 80 | 81 | /** 82 | * Delete templates with the specified ID 83 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 84 | * @param array $templateIDs 85 | */ 86 | public function DeleteBulk($templateIDs) { 87 | return $this->sendRequest('template/deletebulk', array( 88 | 'templateIDs' => (count($templateIDs) === 0) ? null : join(';', $templateIDs))); 89 | } 90 | 91 | /** 92 | * Delete a tag, removing it from all Templates 93 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 94 | * @param string $tag 95 | */ 96 | public function DeleteTag($tag) { 97 | return $this->sendRequest('template/deletetag', array( 98 | 'tag' => $tag)); 99 | } 100 | 101 | /** 102 | * Lists your templates, optionally searching by Tags 103 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 104 | * @param array $tags 105 | * @param array<\ElasticEmailEnums\TemplateType> $templateTypes 106 | * @param int $limit If provided, returns templates with these tags 107 | * @param int $offset Filters on template type 108 | * @return \ElasticEmailEnums\TemplateList 109 | */ 110 | public function GetList(array $tags = array(), array $templateTypes = array(), $limit = 500, $offset = 0) { 111 | return $this->sendRequest('template/getlist', array( 112 | 'tags' => (count($tags) === 0) ? null : join(';', $tags), 113 | 'templateTypes' => (count($templateTypes) === 0) ? null : join(';', $templateTypes), 114 | 'limit' => $limit, 115 | 'offset' => $offset)); 116 | } 117 | 118 | /** 119 | * Retrieve a list of your Tags 120 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 121 | * @return \ElasticEmailEnums\TemplateTagList 122 | */ 123 | public function GetTagList() { 124 | return $this->sendRequest('template/gettaglist', array()); 125 | } 126 | 127 | /** 128 | * Check if template is used by campaign. 129 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 130 | * @param int $templateID ID number of template. 131 | * @return bool 132 | */ 133 | public function IsUsedByCampaign($templateID) { 134 | return $this->sendRequest('template/isusedbycampaign', array( 135 | 'templateID' => $templateID)); 136 | } 137 | 138 | /** 139 | * Load template with content 140 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 141 | * @param int $templateID ID number of template. 142 | * @return \ElasticEmailEnums\Template 143 | */ 144 | public function LoadTemplate($templateID) { 145 | return $this->sendRequest('template/loadtemplate', array( 146 | 'templateID' => $templateID)); 147 | } 148 | 149 | /** 150 | * Read Rss feed 151 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 152 | * @param string $url Rss feed url. 153 | * @param int $count Number of item tags to read. 154 | * @return string 155 | */ 156 | public function ReadRssFeed($url, $count = 3) { 157 | return $this->sendRequest('template/readrssfeed', array( 158 | 'url' => $url, 159 | 'count' => $count)); 160 | } 161 | 162 | /** 163 | * Update existing template, overwriting existing data. Needs to be sent using POST method. 164 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 165 | * @param int $templateID ID number of template. 166 | * @param \ElasticEmailEnums\TemplateScope $templateScope Enum: 0 - private, 1 - public, 2 - mockup 167 | * @param string $name Filename 168 | * @param string $subject Default subject of email. 169 | * @param string $fromEmail Default From: email address. 170 | * @param string $fromName Default From: name. 171 | * @param string $bodyHtml HTML code of email (needs escaping). 172 | * @param string $bodyText Text body of email. 173 | * @param string $css CSS style 174 | * @param bool $removeScreenshot 175 | * @param array $tags 176 | * @param string $bodyAmp AMP code of email (needs escaping). 177 | */ 178 | public function Update($templateID, $templateScope = \ElasticEmailEnums\TemplateScope::EEPrivate, $name = null, $subject = null, $fromEmail = null, $fromName = null, $bodyHtml = null, $bodyText = null, $css = null, $removeScreenshot = true, array $tags = array(), $bodyAmp = null) { 179 | return $this->sendRequest('template/update', array( 180 | 'templateID' => $templateID, 181 | 'templateScope' => $templateScope, 182 | 'name' => $name, 183 | 'subject' => $subject, 184 | 'fromEmail' => $fromEmail, 185 | 'fromName' => $fromName, 186 | 'bodyHtml' => $bodyHtml, 187 | 'bodyText' => $bodyText, 188 | 'css' => $css, 189 | 'removeScreenshot' => $removeScreenshot, 190 | 'tags' => (count($tags) === 0) ? null : join(';', $tags), 191 | 'bodyAmp' => $bodyAmp)); 192 | } 193 | 194 | /** 195 | * Bulk change default options and the scope of your templates 196 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 197 | * @param array $templateIDs 198 | * @param string $subject Default subject of email. 199 | * @param string $fromEmail Default From: email address. 200 | * @param string $fromName Default From: name. 201 | * @param \ElasticEmailEnums\TemplateScope $templateScope Enum: 0 - private, 1 - public, 2 - mockup 202 | */ 203 | public function UpdateDefaultOptions($templateIDs, $subject = null, $fromEmail = null, $fromName = null, $templateScope = \ElasticEmailEnums\TemplateScope::EEPrivate) { 204 | return $this->sendRequest('template/updatedefaultoptions', array( 205 | 'templateIDs' => (count($templateIDs) === 0) ? null : join(';', $templateIDs), 206 | 'subject' => $subject, 207 | 'fromEmail' => $fromEmail, 208 | 'fromName' => $fromName, 209 | 'templateScope' => $templateScope)); 210 | } 211 | 212 | } 213 | -------------------------------------------------------------------------------- /src/ElasticEmailApi/ValidEmail.php: -------------------------------------------------------------------------------- 1 | sendRequest('validemail/add', array( 19 | 'emailAddress' => $emailAddress, 20 | 'returnUrl' => $returnUrl)); 21 | } 22 | 23 | /** 24 | * Get list of all valid emails of account. 25 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 26 | * @return Array<\ElasticEmailEnums\ValidEmail> 27 | */ 28 | public function EEList() { 29 | return $this->sendRequest('validemail/list', array()); 30 | } 31 | 32 | /** 33 | * Delete valid email from account. 34 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 35 | * @param int $validEmailID 36 | */ 37 | public function Remove($validEmailID) { 38 | return $this->sendRequest('validemail/remove', array( 39 | 'validEmailID' => $validEmailID)); 40 | } 41 | 42 | /** 43 | * Resends email verification. 44 | * @param string $apikey ApiKey that gives you access to our SMTP and HTTP API's. 45 | * @param string $emailAddress 46 | * @param string $returnUrl URL to navigate to after Account creation 47 | */ 48 | public function ResendEmailVerification($emailAddress, $returnUrl = null) { 49 | return $this->sendRequest('validemail/resendemailverification', array( 50 | 'emailAddress' => $emailAddress, 51 | 'returnUrl' => $returnUrl)); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/ElasticEmailClient/ApiConfiguration.php: -------------------------------------------------------------------------------- 1 | setApiKey($params['apiKey']); 35 | $this->setApiUrl($params['apiUrl']); 36 | } 37 | 38 | /** 39 | * @param string $apiKey 40 | * @return $this 41 | */ 42 | public function setApiKey(string $apiKey) 43 | { 44 | $this->apiKey = $apiKey; 45 | 46 | return $this; 47 | } 48 | 49 | /** 50 | * @return string 51 | */ 52 | public function getApiKey() 53 | { 54 | return $this->apiKey; 55 | } 56 | 57 | /** 58 | * @param string $apiUrl 59 | * @return $this 60 | */ 61 | public function setApiUrl(string $apiUrl) 62 | { 63 | $this->apiUrl = $apiUrl; 64 | 65 | return $this; 66 | } 67 | 68 | /** 69 | * @return string 70 | */ 71 | public function getApiUrl() 72 | { 73 | return $this->apiUrl; 74 | } 75 | 76 | /** 77 | * @param $timeout 78 | * @return $this 79 | */ 80 | public function setTimeout($timeout) 81 | { 82 | $this->timeOut = $timeout; 83 | 84 | return $this; 85 | } 86 | 87 | /** 88 | * @return float 89 | */ 90 | public function getTimeout() 91 | { 92 | return $this->timeOut; 93 | } 94 | 95 | /** 96 | * @param \GuzzleHttp\ClientInterface $interface 97 | */ 98 | public function setClientInterface(\GuzzleHttp\ClientInterface $interface) 99 | { 100 | $this->clientInterface = $interface; 101 | } 102 | 103 | public function getClientInterface() 104 | { 105 | return $this->clientInterface; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/ElasticEmailClient/ElasticClient.php: -------------------------------------------------------------------------------- 1 | AccessToken= new \ElasticEmailApi\AccessToken($apiConfiguration); 12 | $this->Account= new \ElasticEmailApi\Account($apiConfiguration); 13 | $this->Campaign= new \ElasticEmailApi\Campaign($apiConfiguration); 14 | $this->Channel= new \ElasticEmailApi\Channel($apiConfiguration); 15 | $this->Contact= new \ElasticEmailApi\Contact($apiConfiguration); 16 | $this->Domain= new \ElasticEmailApi\Domain($apiConfiguration); 17 | $this->Email= new \ElasticEmailApi\Email($apiConfiguration); 18 | $this->Export= new \ElasticEmailApi\Export($apiConfiguration); 19 | $this->File= new \ElasticEmailApi\File($apiConfiguration); 20 | $this->EEList= new \ElasticEmailApi\EEList($apiConfiguration); 21 | $this->Log= new \ElasticEmailApi\Log($apiConfiguration); 22 | $this->Segment= new \ElasticEmailApi\Segment($apiConfiguration); 23 | $this->SMS= new \ElasticEmailApi\SMS($apiConfiguration); 24 | $this->Template= new \ElasticEmailApi\Template($apiConfiguration); 25 | $this->ValidEmail= new \ElasticEmailApi\ValidEmail($apiConfiguration); 26 | 27 | } 28 | public $AccessToken; 29 | public $Account; 30 | public $Campaign; 31 | public $Channel; 32 | public $Contact; 33 | public $Domain; 34 | public $Email; 35 | public $Export; 36 | public $File; 37 | public $EEList; 38 | public $Log; 39 | public $Segment; 40 | public $SMS; 41 | public $Template; 42 | public $ValidEmail; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/ElasticEmailClient/ElasticRequest.php: -------------------------------------------------------------------------------- 1 | configuration = $conf; 18 | 19 | if ($conf->getClientInterface()) { 20 | $this->httpClient = $conf->getClientInterface(); 21 | } else { 22 | $this->httpClient = new \GuzzleHttp\Client([ 23 | 'timeout' => $this->configuration->getTimeout() 24 | ]); 25 | } 26 | } 27 | 28 | /** 29 | * @param string $url 30 | * @param array $data 31 | * @param string $method 32 | * @param array $attachments 33 | * @return \Psr\Http\Message\ResponseInterface 34 | * @throws \Exception 35 | */ 36 | protected function sendRequest(string $url, array $data = [], string $method = 'POST', array $attachments = []) 37 | { 38 | $method = strtoupper($method); 39 | 40 | if (!in_array($method, \ElasticEmailClient\ApiConfiguration::AVAILABLE_REQUEST_METHODS)) 41 | { 42 | throw new \Exception('Unallowed request method type'); 43 | } 44 | 45 | $options = []; 46 | $data['apikey'] = $this->configuration->getApiKey(); 47 | 48 | if (!empty($attachments) && $method === 'POST') { 49 | $options['multipart'] = $this->parseMultipart($attachments, $data); 50 | } else { 51 | if (!empty($data) && empty($attachments) && $method === 'POST') { 52 | $options['form_params'] = $data; 53 | } else { 54 | $url.= '?'.http_build_query($data, null, '&'); 55 | } 56 | } 57 | 58 | $url = $this->configuration->getApiUrl(). $url; 59 | 60 | try 61 | { 62 | $response = $this->httpClient->request($method, $url, $options); 63 | $resp = json_decode($response->getBody()->getContents()); 64 | } catch (\Exception $e) { 65 | throw $e; 66 | } 67 | 68 | if (!$resp->success) { 69 | throw new \Exception($resp->error); 70 | } 71 | 72 | if (isset($resp->data) && $resp->data) { return $resp->data; } 73 | 74 | return $resp; 75 | } 76 | 77 | /** 78 | * @param array $attachments 79 | * @param array $params 80 | * @return array 81 | */ 82 | private function parseMultipart(array $attachments, array $params): array 83 | { 84 | $result = []; 85 | 86 | foreach ($attachments as $key => $attachment) { 87 | $result[] = [ 88 | 'name' => 'file_'.$key, 89 | 'contents' => fopen($attachment, 'r'), 90 | 'filename' => basename($attachment) 91 | ]; 92 | } 93 | 94 | foreach ($params as $key => $param) { 95 | $result[] = [ 96 | 'name' => $key, 97 | 'contents' => $param 98 | ]; 99 | } 100 | 101 | return $result; 102 | } 103 | 104 | public function setHttpClient($client) 105 | { 106 | $this->httpClient = $client; 107 | return $this; 108 | } 109 | 110 | /** 111 | * @return \GuzzleHttp\ClientInterface 112 | */ 113 | public function getHttpClient() 114 | { 115 | return $this->httpClient; 116 | } 117 | 118 | /** 119 | * @param \ElasticEmailClient\ApiConfiguration $config 120 | * @return $this 121 | */ 122 | public function setConfiguration(\ElasticEmailClient\ApiConfiguration $config) 123 | { 124 | $this->configuration = $config; 125 | 126 | return $this; 127 | } 128 | 129 | /** 130 | * @return \ElasticEmailClient\ApiConfiguration 131 | */ 132 | public function getConfiguration() 133 | { 134 | return $this->configuration; 135 | } 136 | 137 | } 138 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/AccessLevel.php: -------------------------------------------------------------------------------- 1 | here 118 | */ 119 | public /*?int*/ $CountryID; 120 | 121 | /** 122 | * Phone number 123 | */ 124 | public /*string*/ $Phone; 125 | 126 | /** 127 | * Proper email address. 128 | */ 129 | public /*string*/ $Email; 130 | 131 | /** 132 | * URL for affiliating. 133 | */ 134 | public /*string*/ $AffiliateLink; 135 | 136 | /** 137 | * Numeric reputation 138 | */ 139 | public /*double*/ $Reputation; 140 | 141 | /** 142 | * Amount of emails sent from this Account 143 | */ 144 | public /*long*/ $TotalEmailsSent; 145 | 146 | /** 147 | * Amount of emails sent from this Account 148 | */ 149 | public /*?long*/ $MonthlyEmailsSent; 150 | 151 | /** 152 | * Current credit in Account for Pay as you go plans. 153 | */ 154 | public /*decimal*/ $Credit; 155 | 156 | /** 157 | * Amount of email credits 158 | */ 159 | public /*int*/ $EmailCredits; 160 | 161 | /** 162 | * Amount of emails sent from this Account 163 | */ 164 | public /*decimal*/ $PricePerEmail; 165 | 166 | /** 167 | * Why your clients are receiving your emails. 168 | */ 169 | public /*string*/ $DeliveryReason; 170 | 171 | /** 172 | * URL for making payments. 173 | */ 174 | public /*string*/ $AccountPaymentUrl; 175 | 176 | /** 177 | * Address of SMTP server. 178 | */ 179 | public /*string*/ $Smtp; 180 | 181 | /** 182 | * Address of alternative SMTP server. 183 | */ 184 | public /*string*/ $SmtpAlternative; 185 | 186 | /** 187 | * Status of automatic payments configuration. 188 | */ 189 | public /*string*/ $AutoCreditStatus; 190 | 191 | /** 192 | * When AutoCreditStatus is Enabled, the credit level that triggers the credit to be recharged. 193 | */ 194 | public /*decimal*/ $AutoCreditLevel; 195 | 196 | /** 197 | * When AutoCreditStatus is Enabled, the amount of credit to be recharged. 198 | */ 199 | public /*decimal*/ $AutoCreditAmount; 200 | 201 | /** 202 | * Amount of emails Account can send daily 203 | */ 204 | public /*int*/ $DailySendLimit; 205 | 206 | /** 207 | * Creation date. 208 | */ 209 | public /*DateTime*/ $DateCreated; 210 | 211 | /** 212 | * True, if you have enabled link tracking. Otherwise, false 213 | */ 214 | public /*bool*/ $LinkTracking; 215 | 216 | /** 217 | * Type of content encoding 218 | */ 219 | public /*string*/ $ContentTransferEncoding; 220 | 221 | /** 222 | * Enable contact delivery and optimization tools on your Account. 223 | */ 224 | public /*bool*/ $EnableContactFeatures; 225 | 226 | /** 227 | * 228 | */ 229 | public /*bool*/ $NeedsSMSVerification; 230 | 231 | /** 232 | * 233 | */ 234 | public /*bool*/ $DisableGlobalContacts; 235 | 236 | /** 237 | * 238 | */ 239 | public /*bool*/ $UntrustedDeviceAlertDisabled; 240 | 241 | } 242 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/AccountOverview.php: -------------------------------------------------------------------------------- 1 | */ $Targets; 25 | 26 | /** 27 | * Number of event, triggering mail sending 28 | */ 29 | public /*\ElasticEmailEnums\CampaignTriggerType*/ $TriggerType; 30 | 31 | /** 32 | * Date of triggered send 33 | */ 34 | public /*?DateTime*/ $TriggerDate; 35 | 36 | /** 37 | * How far into the future should the campaign be sent, in minutes 38 | */ 39 | public /*double*/ $TriggerDelay; 40 | 41 | /** 42 | * When your next automatic mail will be sent, in minutes 43 | */ 44 | public /*double*/ $TriggerFrequency; 45 | 46 | /** 47 | * How many times should the campaign be sent 48 | */ 49 | public /*int*/ $TriggerCount; 50 | 51 | /** 52 | * Which Channel's event should trigger this Campaign 53 | */ 54 | public /*?int*/ $TriggerChannelID; 55 | 56 | /** 57 | * 58 | */ 59 | public /*string*/ $TriggerChannelName; 60 | 61 | /** 62 | * Data for filtering event campaigns such as specific link addresses. 63 | */ 64 | public /*string*/ $TriggerData; 65 | 66 | /** 67 | * What should be checked for choosing the winner: opens or clicks 68 | */ 69 | public /*\ElasticEmailEnums\SplitOptimization*/ $SplitOptimization; 70 | 71 | /** 72 | * Number of minutes between sends during optimization period 73 | */ 74 | public /*int*/ $SplitOptimizationMinutes; 75 | 76 | /** 77 | * 78 | */ 79 | public /*int*/ $TimingOption; 80 | 81 | /** 82 | * Should the opens be tracked? If no value has been provided, Account's default setting will be used. 83 | */ 84 | public /*?bool*/ $TrackOpens; 85 | 86 | /** 87 | * Should the clicks be tracked? If no value has been provided, Account's default setting will be used. 88 | */ 89 | public /*?bool*/ $TrackClicks; 90 | 91 | /** 92 | * 93 | */ 94 | public /*Array<\ElasticEmailEnums\CampaignTemplate>*/ $CampaignTemplates; 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/CampaignChannel.php: -------------------------------------------------------------------------------- 1 | */ $Targets; 60 | 61 | /** 62 | * Number of event, triggering mail sending 63 | */ 64 | public /*\ElasticEmailEnums\CampaignTriggerType*/ $TriggerType; 65 | 66 | /** 67 | * Date of triggered send 68 | */ 69 | public /*?DateTime*/ $TriggerDate; 70 | 71 | /** 72 | * How far into the future should the campaign be sent, in minutes 73 | */ 74 | public /*double*/ $TriggerDelay; 75 | 76 | /** 77 | * When your next automatic mail will be sent, in minutes 78 | */ 79 | public /*double*/ $TriggerFrequency; 80 | 81 | /** 82 | * How many times should the campaign be sent 83 | */ 84 | public /*int*/ $TriggerCount; 85 | 86 | /** 87 | * Which Channel's event should trigger this Campaign 88 | */ 89 | public /*int*/ $TriggerChannelID; 90 | 91 | /** 92 | * 93 | */ 94 | public /*string*/ $TriggerChannelName; 95 | 96 | /** 97 | * Data for filtering event campaigns such as specific link addresses. 98 | */ 99 | public /*string*/ $TriggerData; 100 | 101 | /** 102 | * What should be checked for choosing the winner: opens or clicks 103 | */ 104 | public /*\ElasticEmailEnums\SplitOptimization*/ $SplitOptimization; 105 | 106 | /** 107 | * Number of minutes between sends during optimization period 108 | */ 109 | public /*int*/ $SplitOptimizationMinutes; 110 | 111 | /** 112 | * 113 | */ 114 | public /*int*/ $TimingOption; 115 | 116 | /** 117 | * ID number of template. 118 | */ 119 | public /*?int*/ $TemplateID; 120 | 121 | /** 122 | * Name of template. 123 | */ 124 | public /*string*/ $TemplateName; 125 | 126 | /** 127 | * Default subject of email. 128 | */ 129 | public /*string*/ $TemplateSubject; 130 | 131 | /** 132 | * Default From: email address. 133 | */ 134 | public /*string*/ $TemplateFromEmail; 135 | 136 | /** 137 | * Default From: name. 138 | */ 139 | public /*string*/ $TemplateFromName; 140 | 141 | /** 142 | * Default Reply: email address. 143 | */ 144 | public /*string*/ $TemplateReplyEmail; 145 | 146 | /** 147 | * Default Reply: name. 148 | */ 149 | public /*string*/ $TemplateReplyName; 150 | 151 | /** 152 | * Total emails clicked 153 | */ 154 | public /*int*/ $ClickedCount; 155 | 156 | /** 157 | * Total emails opened. 158 | */ 159 | public /*int*/ $OpenedCount; 160 | 161 | /** 162 | * Overall number of recipients 163 | */ 164 | public /*int*/ $RecipientCount; 165 | 166 | /** 167 | * Total emails sent. 168 | */ 169 | public /*int*/ $SentCount; 170 | 171 | /** 172 | * Total emails failed. 173 | */ 174 | public /*int*/ $FailedCount; 175 | 176 | /** 177 | * Total emails unsubscribed 178 | */ 179 | public /*int*/ $UnsubscribedCount; 180 | 181 | /** 182 | * Abuses - mails sent to user without their consent 183 | */ 184 | public /*int*/ $FailedAbuse; 185 | 186 | /** 187 | * List of CampaignTemplate for sending A-X split testing. 188 | */ 189 | public /*Array<\ElasticEmailEnums\CampaignChannel>*/ $TemplateChannels; 190 | 191 | /** 192 | * Should the opens be tracked? If no value has been provided, Account's default setting will be used. 193 | */ 194 | public /*?bool*/ $TrackOpens; 195 | 196 | /** 197 | * Should the clicks be tracked? If no value has been provided, Account's default setting will be used. 198 | */ 199 | public /*?bool*/ $TrackClicks; 200 | 201 | /** 202 | * The utm_source marketing parameter appended to each link in the campaign. 203 | */ 204 | public /*string*/ $UtmSource; 205 | 206 | /** 207 | * The utm_medium marketing parameter appended to each link in the campaign. 208 | */ 209 | public /*string*/ $UtmMedium; 210 | 211 | /** 212 | * The utm_campaign marketing parameter appended to each link in the campaign. 213 | */ 214 | public /*string*/ $UtmCampaign; 215 | 216 | /** 217 | * The utm_content marketing parameter appended to each link in the campaign. 218 | */ 219 | public /*string*/ $UtmContent; 220 | 221 | } 222 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/CampaignStatus.php: -------------------------------------------------------------------------------- 1 | */ $CustomFields; 150 | 151 | } 152 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/ContactCollection.php: -------------------------------------------------------------------------------- 1 | */ $Lists; 10 | 11 | /** 12 | * Segments which contain the requested contact 13 | */ 14 | public /*Array<\ElasticEmailEnums\ContactContainer>*/ $Segments; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/ContactContainer.php: -------------------------------------------------------------------------------- 1 | */ $Failed; 25 | 26 | /** 27 | * Total emails failed. 28 | */ 29 | public /*int*/ $FailedCount; 30 | 31 | /** 32 | * 33 | */ 34 | public /*Array*/ $Sent; 35 | 36 | /** 37 | * Total emails sent. 38 | */ 39 | public /*int*/ $SentCount; 40 | 41 | /** 42 | * Number of delivered messages 43 | */ 44 | public /*Array*/ $Delivered; 45 | 46 | /** 47 | * 48 | */ 49 | public /*int*/ $DeliveredCount; 50 | 51 | /** 52 | * 53 | */ 54 | public /*Array*/ $Pending; 55 | 56 | /** 57 | * 58 | */ 59 | public /*int*/ $PendingCount; 60 | 61 | /** 62 | * Number of opened messages 63 | */ 64 | public /*Array*/ $Opened; 65 | 66 | /** 67 | * Total emails opened. 68 | */ 69 | public /*int*/ $OpenedCount; 70 | 71 | /** 72 | * Number of clicked messages 73 | */ 74 | public /*Array*/ $Clicked; 75 | 76 | /** 77 | * Total emails clicked 78 | */ 79 | public /*int*/ $ClickedCount; 80 | 81 | /** 82 | * Number of unsubscribed messages 83 | */ 84 | public /*Array*/ $Unsubscribed; 85 | 86 | /** 87 | * Total emails unsubscribed 88 | */ 89 | public /*int*/ $UnsubscribedCount; 90 | 91 | /** 92 | * 93 | */ 94 | public /*Array*/ $AbuseReports; 95 | 96 | /** 97 | * 98 | */ 99 | public /*int*/ $AbuseReportsCount; 100 | 101 | /** 102 | * List of all MessageIDs for this job. 103 | */ 104 | public /*Array*/ $MessageIDs; 105 | 106 | } 107 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/EmailSend.php: -------------------------------------------------------------------------------- 1 | */ $Recipients; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/Export.php: -------------------------------------------------------------------------------- 1 | */ $TrackedLink; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/Log.php: -------------------------------------------------------------------------------- 1 | */ $Recipients; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/LogEventStatus.php: -------------------------------------------------------------------------------- 1 | */ $DailyLogStatusSummary; 20 | 21 | /** 22 | * 23 | */ 24 | public /*\ElasticEmailEnums\SubaccountSummary*/ $SubaccountSummary; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/MessageCategory.php: -------------------------------------------------------------------------------- 1 | here 48 | */ 49 | public /*?int*/ $CountryID; 50 | 51 | /** 52 | * Phone number 53 | */ 54 | public /*string*/ $Phone; 55 | 56 | /** 57 | * Proper email address. 58 | */ 59 | public /*string*/ $Email; 60 | 61 | /** 62 | * Code used for tax purposes. 63 | */ 64 | public /*string*/ $TaxCode; 65 | 66 | /** 67 | * Why your clients are receiving your emails. 68 | */ 69 | public /*string*/ $DeliveryReason; 70 | 71 | /** 72 | * True if you want to receive newsletters from Elastic Email. Otherwise, false. Empty to leave the current value. 73 | */ 74 | public /*?bool*/ $MarketingConsent; 75 | 76 | /** 77 | * HTTP address of your website. 78 | */ 79 | public /*string*/ $Website; 80 | 81 | /** 82 | * URL to your logo image. 83 | */ 84 | public /*string*/ $LogoUrl; 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/Recipient.php: -------------------------------------------------------------------------------- 1 | */ $History; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/SegmentHistory.php: -------------------------------------------------------------------------------- 1 | */ $Rules; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/SpamRule.php: -------------------------------------------------------------------------------- 1 | */ $Tags; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/TemplateList.php: -------------------------------------------------------------------------------- 1 | */ $Templates; 10 | 11 | /** 12 | * Total of templates 13 | */ 14 | public /*int*/ $TemplatesCount; 15 | 16 | /** 17 | * List of draft templates 18 | */ 19 | public /*Array<\ElasticEmailEnums\Template>*/ $DraftTemplate; 20 | 21 | /** 22 | * Total of draft templates 23 | */ 24 | public /*int*/ $DraftTemplatesCount; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/TemplateScope.php: -------------------------------------------------------------------------------- 1 | */ $Tags; 10 | 11 | /** 12 | * List of globally available Tags 13 | */ 14 | public /*Array<\ElasticEmailEnums\TemplateTag>*/ $GlobalTags; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/TemplateType.php: -------------------------------------------------------------------------------- 1 | */ $List; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/UsageData.php: -------------------------------------------------------------------------------- 1 | */ $Errors; 15 | 16 | /** 17 | * 18 | */ 19 | public /*string*/ $Log; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/ElasticEmailEnums/WebNotificationOptions.php: -------------------------------------------------------------------------------- 1 | getRealPath(); 100 | unset($FileInfo); 101 | 102 | // Include the multiclass file and declare its classes. 103 | require($multiclassFile); 104 | 105 | /** @var array $declaredClasses Names of all declared classes, including those of the multiclass file */ 106 | $declaredClasses = get_declared_classes(); 107 | 108 | /** @var array $multiclassFileClasses Each element will be one class: its name, code, etc. */ 109 | $multiclassFileClasses = []; 110 | 111 | // Echo output in CSV w column headers 112 | echo "Class,Bytes\n"; 113 | 114 | // Filter the declared classes, keeping only those declared in the multiclass file. 115 | foreach($declaredClasses as $class) 116 | { 117 | // Reflect each declared class to discover its file source 118 | /** @var ReflectionClass $R Reflect each declared class to get file and source code info */ 119 | $R = new ReflectionClass($class); 120 | // If the declared class comes from the multiclass file, then save it 121 | if ($realPath == $R->getFilename()) 122 | { 123 | // Open the code string PHP tag and optionally define a namespace 124 | $multiclassFileClasses[$class] = "getNamespaceName() ."; \n\n"; 125 | 126 | $destDir = $outputDir . DIRECTORY_SEPARATOR . $R->getNamespaceName(); 127 | if (!is_dir( $destDir)) 128 | { 129 | mkdir($destDir, 0755, true); 130 | chmod($destDir, 0755); 131 | } 132 | 133 | // Get the code line by line from the source file, saving it to the output array 134 | for ($i = $R->getStartLine() - 1; $i < $R->getEndLine(); ++$i) 135 | { 136 | // Every line before last line: save line as is 137 | if ($i < $R->getEndLine() - 1) 138 | { 139 | $multiclassFileClasses[$class] .= $multiclassLines[$i]; 140 | } 141 | // Last line: remove double }} that can happen when class is nested in "if (!class_exists(" 142 | else 143 | { 144 | $multiclassFileClasses[$class] .= preg_replace('/^}}$/', '}', $multiclassLines[$i]); 145 | } 146 | unset($multiclassLines[$i]); 147 | } 148 | 149 | // Save the class to a file 150 | //var_dump($outputDir, $class); 151 | $fileHandle = fopen( $destDir . DIRECTORY_SEPARATOR . $R->getShortName() . '.php', 'w'); 152 | $bytesWritten = fwrite($fileHandle, $multiclassFileClasses[$class]); 153 | fclose($fileHandle); 154 | echo $R->getShortName() . ".php,$bytesWritten\n"; 155 | } 156 | } 157 | 158 | 159 | 160 | exit; --------------------------------------------------------------------------------