├── .gitignore ├── LICENSE.txt ├── README.md ├── composer.json ├── composer.lock ├── docs ├── 404.html ├── class-Inbox.html ├── class-Mailinator.html ├── class-Message.html ├── elementlist.js ├── index.html ├── package-Mailinator.html ├── resources │ ├── collapsed.png │ ├── combined.js │ ├── footer.png │ ├── inherit.png │ ├── resize.png │ ├── sort.png │ ├── style.css │ ├── tree-cleaner.png │ ├── tree-hasnext.png │ ├── tree-last.png │ └── tree-vertical.png ├── source-class-Inbox.html ├── source-class-Mailinator.html └── source-class-Message.html └── src └── Mailinator └── Mailinator.php /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Intellij ### 4 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 5 | 6 | *.iml 7 | 8 | ## Directory-based project format: 9 | .idea/ 10 | # if you remove the above rule, at least ignore the following: 11 | 12 | # User-specific stuff: 13 | # .idea/workspace.xml 14 | # .idea/tasks.xml 15 | # .idea/dictionaries 16 | 17 | # Sensitive or high-churn files: 18 | # .idea/dataSources.ids 19 | # .idea/dataSources.xml 20 | # .idea/sqlDataSources.xml 21 | # .idea/dynamic.xml 22 | # .idea/uiDesigner.xml 23 | 24 | # Gradle: 25 | # .idea/gradle.xml 26 | # .idea/libraries 27 | 28 | # Mongo Explorer plugin: 29 | # .idea/mongoSettings.xml 30 | 31 | ## File-based project format: 32 | *.ipr 33 | *.iws 34 | 35 | /vendor/ 36 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Pieter De Clercq 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mailinator_php 2 | 3 | [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/brnlbs/mailinator/blob/master/LICENSE) 4 | [![Monthly downloads](https://img.shields.io/packagist/dm/thepieterdc/mailinator_php.svg)](https://packagist.org/packages/thepieterdc/mailinator_php)[![Daily downloads](https://img.shields.io/packagist/dd/thepieterdc/mailinator_php.svg)](https://packagist.org/packages/thepieterdc/mailinator_php)[![Total downloads](https://img.shields.io/packagist/dt/thepieterdc/mailinator_php.svg)](https://packagist.org/packages/thepieterdc/mailinator_php) 5 | 6 | PHP wrapper for the Mailinator.com API 7 | 8 | ## Token 9 | Create a [Mailinator](http://www.mailinator.com) account, login, and find your token at [https://www.mailinator.com/settings.jsp](https://www.mailinator.com/settings.jsp) 10 | 11 | ## Requirements 12 | You need to have the [cURL](http://php.net/manual/en/book.curl.php)-extension installed on your server. [PHP](http://www.php.net) 5.2 will suffice. 13 | 14 | ## Usage 15 | ``` php 16 | require_once 'src/Mailinator/Mailinator.php'; 17 | $mailinator = new Mailinator('my_token'); 18 | 19 | //Get messages in inbox// 20 | try 21 | { 22 | print_r($mailinator->inbox('randominbox')); 23 | } catch(Exception $e) { 24 | // Process the error 25 | echo "Something went wrong: " . $e->getMessage(); 26 | } 27 | 28 | //Get a message// 29 | try 30 | { 31 | print_r($mailinator->message('mail-id')); 32 | } catch(Exception $e) { 33 | // Process the error 34 | echo "Something went wrong: " . $e->getMessage(); 35 | } 36 | 37 | //Delete a message// 38 | try 39 | { 40 | print_r($mailinator->delete('mail-id')); 41 | } catch(Exception $e) { 42 | // Process the error 43 | echo "Something went wrong: " . $e->getMessage(); 44 | } 45 | ``` 46 | 47 | ## License 48 | 49 | The MIT License (MIT). Please see [License File](https://github.com/thepieterdc/mailinator_php/blob/master/LICENSE.txt) for more information. 50 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "thepieterdc/mailinator_php", 3 | "description": "PHP wrapper for the Mailinator.com API", 4 | "type": "library", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "Pieter De Clercq", 9 | "email": "pieterdeclercq@outlook.com" 10 | }, 11 | { 12 | "name": "Muntean Doru", 13 | "email": "munteandoru@gmail.com" 14 | } 15 | ], 16 | "require": { 17 | "php": ">=5.2.1" 18 | }, 19 | "autoload": { 20 | "psr-0": { 21 | "Mailinator": "src/" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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#composer-lock-the-lock-file", 5 | "This file is @generated automatically" 6 | ], 7 | "hash": "700f31d85c05ff0e2fe30586e7a4028f", 8 | "content-hash": "74f159807304ab650c0de88875e7e9d3", 9 | "packages": [], 10 | "packages-dev": [], 11 | "aliases": [], 12 | "minimum-stability": "stable", 13 | "stability-flags": [], 14 | "prefer-stable": false, 15 | "prefer-lowest": false, 16 | "platform": { 17 | "php": ">=5.2.1" 18 | }, 19 | "platform-dev": [] 20 | } 21 | -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Page not found 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 47 |
48 | 49 |
50 | 51 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /docs/class-Inbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Inbox 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 46 |
47 | 48 |
49 | 50 | 239 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /docs/class-Mailinator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Mailinator 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 46 |
47 | 48 |
49 | 50 | 302 | 303 | 304 | 305 | 306 | -------------------------------------------------------------------------------- /docs/class-Message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Class Message 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 46 |
47 | 48 |
49 | 50 | 515 | 516 | 517 | 518 | 519 | -------------------------------------------------------------------------------- /docs/elementlist.js: -------------------------------------------------------------------------------- 1 | 2 | var ApiGen = ApiGen || {}; 3 | ApiGen.elements = [["c","Inbox"],["c","Mailinator"],["c","Message"]]; 4 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Overview 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 45 |
46 | 47 |
48 | 49 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/package-Mailinator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Package Mailinator 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 46 |
47 | 48 |
49 | 50 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /docs/resources/collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/collapsed.png -------------------------------------------------------------------------------- /docs/resources/footer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/footer.png -------------------------------------------------------------------------------- /docs/resources/inherit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/inherit.png -------------------------------------------------------------------------------- /docs/resources/resize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/resize.png -------------------------------------------------------------------------------- /docs/resources/sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/sort.png -------------------------------------------------------------------------------- /docs/resources/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | font: 13px/1.5 Verdana, 'Geneva CE', lucida, sans-serif; 3 | margin: 0; 4 | padding: 0; 5 | background: #ffffff; 6 | color: #333333; 7 | } 8 | 9 | h1, h2, h3, h4, caption { 10 | font-family: 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; 11 | color: #053368; 12 | } 13 | 14 | h1 { 15 | color: #1e5eb6; 16 | font-size: 230%; 17 | font-weight: normal; 18 | margin: .3em 0; 19 | } 20 | 21 | h2 { 22 | color: #1e5eb6; 23 | font-size: 150%; 24 | font-weight: normal; 25 | margin: -.3em 0 .3em 0; 26 | } 27 | 28 | h3 { 29 | font-size: 1.6em; 30 | font-weight: normal; 31 | margin-bottom: 2px; 32 | } 33 | 34 | h4 { 35 | font-size: 100%; 36 | font-weight: bold; 37 | padding: 0; 38 | margin: 0; 39 | } 40 | 41 | caption { 42 | border: 1px solid #cccccc; 43 | background: #ecede5; 44 | font-weight: bold; 45 | font-size: 1.2em; 46 | padding: 3px 5px; 47 | text-align: left; 48 | margin-bottom: 0; 49 | } 50 | 51 | p { 52 | margin: .7em 0 1em; 53 | padding: 0; 54 | } 55 | 56 | hr { 57 | margin: 2em 0 1em; 58 | border: none; 59 | border-top: 1px solid #cccccc; 60 | height: 0; 61 | } 62 | 63 | a { 64 | color: #006aeb; 65 | padding: 3px 1px; 66 | text-decoration: none; 67 | } 68 | 69 | h1 a { 70 | color: #1e5eb6; 71 | } 72 | 73 | a:hover, a:active, a:focus, a:hover b, a:hover var { 74 | background-color: #006aeb; 75 | color: #ffffff !important; 76 | } 77 | 78 | code, var, pre { 79 | font-family: monospace; 80 | } 81 | 82 | var { 83 | font-weight: bold; 84 | font-style: normal; 85 | color: #ca8a04; 86 | } 87 | 88 | pre { 89 | margin: 0; 90 | } 91 | 92 | code a b { 93 | color: #000000; 94 | } 95 | 96 | .deprecated { 97 | text-decoration: line-through; 98 | opacity: .5; 99 | } 100 | 101 | .invalid { 102 | color: #e71818; 103 | } 104 | 105 | .hidden { 106 | display: none; 107 | } 108 | 109 | /* Left side */ 110 | #left { 111 | overflow: auto; 112 | width: 270px; 113 | height: 100%; 114 | position: fixed; 115 | } 116 | 117 | /* Menu */ 118 | #menu { 119 | padding: 10px; 120 | } 121 | 122 | #menu ul { 123 | list-style: none; 124 | padding: 0; 125 | margin: 0; 126 | } 127 | 128 | #menu ul ul { 129 | padding-left: 10px; 130 | } 131 | 132 | #menu li { 133 | white-space: nowrap; 134 | position: relative; 135 | } 136 | 137 | #menu a { 138 | display: block; 139 | padding: 0 2px; 140 | } 141 | 142 | #menu .active > a, #menu > span { 143 | color: #333333; 144 | background: none; 145 | font-weight: bold; 146 | } 147 | 148 | #menu .active > a.invalid { 149 | color: #e71818; 150 | } 151 | 152 | #menu .active > a:hover, #menu .active > a:active, #menu .active > a:focus { 153 | background-color: #006aeb; 154 | } 155 | 156 | #menu #groups span { 157 | position: absolute; 158 | top: 4px; 159 | right: 2px; 160 | cursor: pointer; 161 | display: block; 162 | width: 12px; 163 | height: 12px; 164 | background: url('collapsed.png') transparent 0 0 no-repeat; 165 | } 166 | 167 | #menu #groups span:hover { 168 | background-position: -12px 0; 169 | } 170 | 171 | #menu #groups span.collapsed { 172 | background-position: 0 -12px; 173 | } 174 | 175 | #menu #groups span.collapsed:hover { 176 | background-position: -12px -12px; 177 | } 178 | 179 | #menu #groups ul.collapsed { 180 | display: none; 181 | } 182 | 183 | /* Right side */ 184 | #right { 185 | overflow: auto; 186 | margin-left: 275px; 187 | height: 100%; 188 | position: relative; 189 | left: 0; 190 | right: 0; 191 | } 192 | 193 | #rightInner { 194 | max-width: 1000px; 195 | min-width: 350px; 196 | } 197 | 198 | /* Search */ 199 | #search { 200 | float: right; 201 | margin: 3px 8px; 202 | } 203 | 204 | #search input.text { 205 | padding: 3px 5px; 206 | width: 250px; 207 | } 208 | 209 | /* Autocomplete */ 210 | .ac_results { 211 | padding: 0; 212 | border: 1px solid #cccccc; 213 | background-color: #ffffff; 214 | overflow: hidden; 215 | z-index: 99999; 216 | } 217 | 218 | .ac_results ul { 219 | width: 100%; 220 | list-style-position: outside; 221 | list-style: none; 222 | padding: 0; 223 | margin: 0; 224 | } 225 | 226 | .ac_results li { 227 | margin: 0; 228 | padding: 2px 5px; 229 | cursor: default; 230 | display: block; 231 | font: 12px 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; 232 | line-height: 16px; 233 | overflow: hidden; 234 | white-space: nowrap; 235 | } 236 | 237 | .ac_results li strong { 238 | color: #000000; 239 | } 240 | 241 | .ac_odd { 242 | background-color: #eeeeee; 243 | } 244 | 245 | .ac_over { 246 | background-color: #006aeb; 247 | color: #ffffff; 248 | } 249 | 250 | .ac_results li.ac_over strong { 251 | color: #ffffff; 252 | } 253 | 254 | /* Navigation */ 255 | #navigation { 256 | padding: 3px 8px; 257 | background-color: #f6f6f4; 258 | height: 26px; 259 | } 260 | 261 | #navigation ul { 262 | list-style: none; 263 | margin: 0 8px 4px 0; 264 | padding: 0; 265 | overflow: hidden; 266 | float: left; 267 | } 268 | 269 | #navigation ul + ul { 270 | border-left: 1px solid #000000; 271 | padding-left: 8px; 272 | } 273 | 274 | #navigation ul li { 275 | float: left; 276 | margin: 2px; 277 | padding: 0 3px; 278 | font-family: Verdana, 'Geneva CE', lucida, sans-serif; 279 | color: #808080; 280 | } 281 | 282 | #navigation ul li.active { 283 | background-color: #053368; 284 | color: #ffffff; 285 | font-weight: bold; 286 | } 287 | 288 | #navigation ul li a { 289 | color: #000000; 290 | font-weight: bold; 291 | padding: 0; 292 | } 293 | 294 | #navigation ul li span { 295 | float: left; 296 | padding: 0 3px; 297 | } 298 | 299 | #navigation ul li a:hover span, #navigation ul li a:active span, #navigation ul li a:focus span { 300 | background-color: #006aeb; 301 | } 302 | 303 | /* Content */ 304 | #content { 305 | clear: both; 306 | padding: 5px 15px; 307 | } 308 | 309 | .description pre { 310 | padding: .6em; 311 | background: #fcfcf7; 312 | } 313 | 314 | #content > .description { 315 | background: #ecede5; 316 | padding: 1px 8px; 317 | margin: 1.2em 0; 318 | } 319 | 320 | #content > .description pre { 321 | margin: .5em 0; 322 | } 323 | 324 | dl.tree { 325 | margin: 1.2em 0; 326 | } 327 | 328 | dl.tree dd { 329 | margin: 0; 330 | padding: 0; 331 | } 332 | 333 | .info { 334 | margin: 1.2em 0; 335 | } 336 | 337 | .summary { 338 | border: 1px solid #cccccc; 339 | border-collapse: collapse; 340 | font-size: 1em; 341 | width: 100%; 342 | margin: 1.2em 0 2.4em; 343 | } 344 | 345 | .summary caption { 346 | border-width: 1px 1px 0; 347 | } 348 | 349 | .summary caption.switchable { 350 | background: #ecede5 url('sort.png') no-repeat center right; 351 | cursor: pointer; 352 | } 353 | 354 | .summary td { 355 | border: 1px solid #cccccc; 356 | margin: 0; 357 | padding: 3px 10px; 358 | font-size: 1em; 359 | vertical-align: top; 360 | } 361 | 362 | .summary td:first-child { 363 | text-align: right; 364 | } 365 | 366 | .summary td hr { 367 | margin: 3px -10px; 368 | } 369 | 370 | #packages.summary td:first-child, #namespaces.summary td:first-child, .inherited.summary td:first-child, .used.summary td:first-child { 371 | text-align: left; 372 | } 373 | 374 | .summary tr:hover td { 375 | background: #f6f6f4; 376 | } 377 | 378 | .summary .description pre { 379 | border: .5em solid #ecede5; 380 | } 381 | 382 | .summary .description p { 383 | margin: 0; 384 | } 385 | 386 | .summary .description p + p, .summary .description ul { 387 | margin: 3px 0 0 0; 388 | } 389 | 390 | .summary .description.detailed h4 { 391 | margin-top: 3px; 392 | } 393 | 394 | .summary dl { 395 | margin: 0; 396 | } 397 | 398 | .summary dd { 399 | margin: 0 0 0 25px; 400 | } 401 | 402 | .name, .attributes { 403 | white-space: nowrap; 404 | } 405 | 406 | .value code { 407 | white-space: pre-wrap; 408 | } 409 | 410 | td.name, td.attributes { 411 | width: 1%; 412 | } 413 | 414 | td.attributes { 415 | width: 1%; 416 | } 417 | 418 | .class .methods .name, .class .properties .name, .class .constants .name { 419 | width: auto; 420 | white-space: normal; 421 | } 422 | 423 | .class .methods .name > div > code { 424 | white-space: pre-wrap; 425 | } 426 | 427 | .class .methods .name > div > code span, .function .value > code { 428 | white-space: nowrap; 429 | } 430 | 431 | .class .methods td.name > div, .class td.value > div { 432 | position: relative; 433 | padding-right: 1em; 434 | } 435 | 436 | .anchor { 437 | position: absolute; 438 | top: 0; 439 | right: 0; 440 | line-height: 1; 441 | font-size: 85%; 442 | margin: 0; 443 | color: #006aeb !important; 444 | } 445 | 446 | .list { 447 | margin: 0 0 5px 25px; 448 | } 449 | 450 | div.invalid { 451 | background-color: #fae4e0; 452 | padding: 10px; 453 | } 454 | 455 | /* Splitter */ 456 | #splitter { 457 | position: fixed; 458 | height: 100%; 459 | width: 5px; 460 | left: 270px; 461 | background: #1e5eb6 url('resize.png') left center no-repeat; 462 | cursor: e-resize; 463 | } 464 | 465 | #splitter.active { 466 | opacity: .5; 467 | } 468 | 469 | /* Footer */ 470 | #footer { 471 | border-top: 1px solid #e9eeef; 472 | clear: both; 473 | color: #a7a7a7; 474 | font-size: 8pt; 475 | text-align: center; 476 | padding: 20px 0 0; 477 | margin: 3em 0 0; 478 | height: 90px; 479 | background: #ffffff url('footer.png') no-repeat center top; 480 | } 481 | 482 | /* Tree */ 483 | div.tree ul { 484 | list-style: none; 485 | background: url('tree-vertical.png') left repeat-y; 486 | padding: 0; 487 | margin-left: 20px; 488 | } 489 | 490 | div.tree li { 491 | margin: 0; 492 | padding: 0; 493 | } 494 | 495 | div.tree div { 496 | padding-left: 30px; 497 | } 498 | 499 | div.tree div.notlast { 500 | background: url('tree-hasnext.png') left 10px no-repeat; 501 | } 502 | 503 | div.tree div.last { 504 | background: url('tree-last.png') left -240px no-repeat; 505 | } 506 | 507 | div.tree li.last { 508 | background: url('tree-cleaner.png') left center repeat-y; 509 | } 510 | 511 | div.tree span.padding { 512 | padding-left: 15px; 513 | } 514 | 515 | /* Source code */ 516 | .php-keyword1 { 517 | color: #e71818; 518 | font-weight: bold; 519 | } 520 | 521 | .php-keyword2 { 522 | font-weight: bold; 523 | } 524 | 525 | .php-var { 526 | color: #d59401; 527 | font-weight: bold; 528 | } 529 | 530 | .php-num { 531 | color: #cd0673; 532 | } 533 | 534 | .php-quote { 535 | color: #008000; 536 | } 537 | 538 | .php-comment { 539 | color: #929292; 540 | } 541 | 542 | .xlang { 543 | color: #ff0000; 544 | font-weight: bold; 545 | } 546 | 547 | span.l { 548 | display: block; 549 | } 550 | 551 | span.l.selected { 552 | background: #f6f6f4; 553 | } 554 | 555 | span.l a { 556 | color: #333333; 557 | } 558 | 559 | span.l a:hover, div.l a:active, div.l a:focus { 560 | background: transparent; 561 | color: #333333 !important; 562 | } 563 | 564 | span.l .php-var a { 565 | color: #d59401; 566 | } 567 | 568 | span.l .php-var a:hover, span.l .php-var a:active, span.l .php-var a:focus { 569 | color: #d59401 !important; 570 | } 571 | 572 | span.l a.l { 573 | padding-left: 2px; 574 | color: #c0c0c0; 575 | } 576 | 577 | span.l a.l:hover, span.l a.l:active, span.l a.l:focus { 578 | background: transparent; 579 | color: #c0c0c0 !important; 580 | } 581 | 582 | #rightInner.medium #navigation { 583 | height: 52px; 584 | } 585 | 586 | #rightInner.medium #navigation ul:first-child + ul { 587 | clear: left; 588 | border: none; 589 | padding: 0; 590 | } 591 | 592 | #rightInner.medium .name, #rightInner.medium .attributes { 593 | white-space: normal; 594 | } 595 | 596 | #rightInner.small #search { 597 | float: left; 598 | } 599 | 600 | #rightInner.small #navigation { 601 | height: 78px; 602 | } 603 | 604 | #rightInner.small #navigation ul:first-child { 605 | clear: both; 606 | } 607 | 608 | /* global style */ 609 | .left, .summary td.left { 610 | text-align: left; 611 | } 612 | .right, .summary td.right { 613 | text-align: right; 614 | } 615 | -------------------------------------------------------------------------------- /docs/resources/tree-cleaner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/tree-cleaner.png -------------------------------------------------------------------------------- /docs/resources/tree-hasnext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/tree-hasnext.png -------------------------------------------------------------------------------- /docs/resources/tree-last.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/tree-last.png -------------------------------------------------------------------------------- /docs/resources/tree-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thepieterdc/mailinator-php/dfa4a5c8a42ec615215382d5e396252d6348b85b/docs/resources/tree-vertical.png -------------------------------------------------------------------------------- /docs/source-class-Inbox.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | File Mailinator/Mailinator.php 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 47 |
48 | 49 |
50 | 51 | 361 | 362 | 363 | 364 | 365 | -------------------------------------------------------------------------------- /docs/source-class-Mailinator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | File Mailinator/Mailinator.php 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 47 |
48 | 49 |
50 | 51 | 361 | 362 | 363 | 364 | 365 | -------------------------------------------------------------------------------- /docs/source-class-Message.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | File Mailinator/Mailinator.php 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 47 |
48 | 49 |
50 | 51 | 361 | 362 | 363 | 364 | 365 | -------------------------------------------------------------------------------- /src/Mailinator/Mailinator.php: -------------------------------------------------------------------------------- 1 | 9 | * @author Muntean Doru 10 | */ 11 | class Mailinator { 12 | /** 13 | * The user's token, used to authenticate with the Mailinator API. Can be obtained by creating a free account at http://www.mailinator.com/ 14 | * @var string 15 | */ 16 | private $token; 17 | 18 | /** 19 | * Constructs a new Mailinator instance. 20 | * 21 | * @param string $token The user's token, used to authenticate with the Mailinator API. Can be obtained by creating a free account at http://www.mailinator.com/ 22 | */ 23 | public function __construct($token) { 24 | $this->token = $token; 25 | } 26 | 27 | /** 28 | * Makes a call to the Mailinator API. 29 | * 30 | * @param string $method The method to call 31 | * @param array $params The parameters to send 32 | * @return array The JSON decoded response from the Mailinator API 33 | * @throws \Exception Any errors encountered 34 | */ 35 | private function call($method, $params) { 36 | $ch = curl_init(); 37 | 38 | $callback_parameters = http_build_query(array_merge($params, array('token' => $this->token)),'', '&'); 39 | curl_setopt($ch, CURLOPT_URL, "https://api.mailinator.com/api/" . $method . '?' . $callback_parameters); 40 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 41 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 42 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); 43 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 44 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 45 | 46 | $exec = curl_exec($ch); 47 | $info = curl_getinfo($ch); 48 | curl_close($ch); 49 | 50 | if($info["http_code"] == 200) { 51 | return json_decode($exec, true); 52 | } else { 53 | throw new \Exception('There was an error contacting the Mailinator API endpoint.'); 54 | } 55 | } 56 | 57 | /** 58 | * Gets the messages for a specified inbox. 59 | * 60 | * @param string $inbox The e-mailaddress to query 61 | * @return Inbox The inbox 62 | * @throws \Exception Any errors encountered 63 | */ 64 | public function inbox($inbox) { 65 | $query = $this->call('inbox', array('to' => $inbox)); 66 | 67 | if(!isset($query["messages"])) { 68 | throw new \Exception('Missing messages data in response from Mailinator API.'); 69 | } 70 | return new Inbox($query["messages"]); 71 | } 72 | 73 | /** 74 | * Gets the message details for the specified message id. 75 | * 76 | * @param string $msgId The id of the message 77 | * @return Message the message 78 | * @throws \Exception Any errors encountered 79 | */ 80 | public function message($msgId) { 81 | $query = $this->call('email', array('id' => $msgId)); 82 | 83 | if(!isset($query["data"])) { 84 | throw new \Exception('Missing data in response from Mailinator API.'); 85 | } 86 | 87 | return new Message($query["data"]); 88 | } 89 | 90 | /** 91 | * Deletes a specified message from the inbox 92 | * 93 | * @param string $msgId The id of the message to delete 94 | * @return bool true if the message was deleted 95 | * @throws \Exception Any errors encountered 96 | */ 97 | public function delete($msgId) { 98 | $query = $this->call('delete', array('id' => $msgId)); 99 | 100 | if(!isset($query["status"])) { 101 | throw new \Exception("Missing result in response from Mailinator API."); 102 | } 103 | 104 | return $query["status"] == "ok"; 105 | } 106 | } 107 | 108 | /** 109 | * Mailinator Inbox 110 | * @package Mailinator 111 | * @license http://opensource.org/licenses/MIT 112 | * @since 2015-09-26 113 | * @author Pieter De Clercq 114 | */ 115 | class Inbox { 116 | 117 | private $messages = array(); 118 | 119 | /** 120 | * Constructs a new inbox. 121 | * 122 | * @param array $returnData The data received from a call to the Mailinator API 123 | */ 124 | public function __construct($returnData) { 125 | foreach($returnData as $message) { 126 | $this->messages[] = new Message($message); 127 | } 128 | } 129 | 130 | /** 131 | * Returns the messages in this inbox 132 | * 133 | * @return array The list of messages in this inbox as an array of Message objects 134 | */ 135 | public function messages() { 136 | return $this->messages; 137 | } 138 | 139 | /** 140 | * Counts the amount of messages in this inbox. 141 | * 142 | * @return int The amount of messages in this inbox 143 | */ 144 | public function count() { 145 | return count($this->messages); 146 | } 147 | } 148 | 149 | /** 150 | * Mailinator Message 151 | * @package Mailinator 152 | * @license http://opensource.org/licenses/MIT 153 | * @since 2015-09-26 154 | * @author Pieter De Clercq 155 | */ 156 | class Message { 157 | private $body; 158 | private $fromEmail; 159 | private $fromName; 160 | private $headers = array(); 161 | private $id; 162 | private $ip; 163 | private $read; 164 | private $subject; 165 | private $time; 166 | private $to; 167 | private $secondsAgo; 168 | 169 | /** 170 | * Constructs a new message. 171 | * 172 | * @param array $returnData The data received from a call to the Mailinator API 173 | */ 174 | public function __construct($msgData) { 175 | if(isset($msgData["parts"]) && isset($msgData["parts"][0]) && isset($msgData["parts"][0]["body"])) { 176 | $this->body = $msgData["parts"][0]["body"]; 177 | } 178 | $this->fromEmail = isset($msgData["fromEmail"]) ? $msgData["fromEmail"] : null; 179 | $this->fromName = isset($msgData["from"]) ? $msgData["from"] : null; 180 | if(isset($msgData["headers"])) { 181 | $this->headers = $msgData["headers"]; 182 | } 183 | $this->id = $msgData["id"]; 184 | $this->ip = isset($msgData["ip"]) ? $msgData["ip"] : null; 185 | $this->read = isset($msgData["been_read"]) ? $msgData["been_read"] : null; 186 | $this->subject = $msgData["subject"]; 187 | $this->time = $msgData["time"]; 188 | $this->to = $msgData["to"]; 189 | $this->secondsAgo = $msgData["seconds_ago"]; 190 | } 191 | 192 | /** 193 | * Returns the contents of this message. 194 | * This is only available if the message has been constructed from a call to Mailinator->message() 195 | * 196 | * @return string The message contents 197 | */ 198 | public function body() { 199 | return $this->body; 200 | } 201 | 202 | /** 203 | * Returns the sender's email. 204 | * 205 | * @return string The sender's email 206 | */ 207 | public function fromEmail() { 208 | return $this->fromEmail; 209 | } 210 | 211 | /** 212 | * Returns the name of the sender. 213 | * 214 | * @return string The sender's name 215 | */ 216 | public function fromName() { 217 | return $this->fromName; 218 | } 219 | /** 220 | * Returns the headers of this message. 221 | * This is only available if the message has been constructed from a call to Mailinator->message() 222 | * 223 | * @return array The message headers 224 | */ 225 | public function headers() { 226 | return $this->headers; 227 | } 228 | 229 | /** 230 | * Returns the id of this message. 231 | * 232 | * @return int The message id 233 | */ 234 | public function id() { 235 | return $this->id; 236 | } 237 | 238 | /** 239 | * Returns the IP address of the mailserver this message is originating from. 240 | * 241 | * @return string The mailserver's IP address 242 | */ 243 | public function ip() { 244 | return $this->ip; 245 | } 246 | 247 | /** 248 | * Returns wether or not this message has been read. 249 | * 250 | * @return bool true if this message has been read 251 | */ 252 | public function read() { 253 | return $this->read; 254 | } 255 | 256 | /** 257 | * Returns the subject of this message. 258 | * 259 | * @return string The subject of this message 260 | */ 261 | public function subject() { 262 | return $this->subject; 263 | } 264 | 265 | /** 266 | * Returns the time this message was sent. 267 | * 268 | * @return int The time this message was sent, in seconds since 01/01/1970 269 | */ 270 | public function time() { 271 | return $this->time; 272 | } 273 | 274 | /** 275 | * Returns the name of the receiver of this message. 276 | * 277 | * @return string The name of the receiver of this message 278 | */ 279 | public function to() { 280 | return $this->to; 281 | } 282 | 283 | /** 284 | * Returns the time this message was sent. 285 | * 286 | * @return int The time this message was sent, in seconds. 287 | */ 288 | public function secondsAgo(){ 289 | return $this->secondsAgo; 290 | } 291 | } 292 | --------------------------------------------------------------------------------