xref: /plugin/smtp/subtree/txtthinking/Mailer/src/Mailer/Exceptions/CodeException.php (revision 269d5ff46c37c7e45f82c18bc0cc45d491b48a4a)
1*269d5ff4SAndreas Gohr<?php
2*269d5ff4SAndreas Gohr/***************************************************\
3*269d5ff4SAndreas Gohr *
4*269d5ff4SAndreas Gohr *  Mailer (https://github.com/txthinking/Mailer)
5*269d5ff4SAndreas Gohr *
6*269d5ff4SAndreas Gohr *  A lightweight PHP SMTP mail sender.
7*269d5ff4SAndreas Gohr *  Implement RFC0821, RFC0822, RFC1869, RFC2045, RFC2821
8*269d5ff4SAndreas Gohr *
9*269d5ff4SAndreas Gohr *  Support html body, don't worry that the receiver's
10*269d5ff4SAndreas Gohr *  mail client can't support html, because Mailer will
11*269d5ff4SAndreas Gohr *  send both text/plain and text/html body, so if the
12*269d5ff4SAndreas Gohr *  mail client can't support html, it will display the
13*269d5ff4SAndreas Gohr *  text/plain body.
14*269d5ff4SAndreas Gohr *
15*269d5ff4SAndreas Gohr *  Create Date 2012-07-25.
16*269d5ff4SAndreas Gohr *  Under the MIT license.
17*269d5ff4SAndreas Gohr *
18*269d5ff4SAndreas Gohr \***************************************************/
19*269d5ff4SAndreas Gohr/**
20*269d5ff4SAndreas Gohr * Created by PhpStorm.
21*269d5ff4SAndreas Gohr * User: msowers
22*269d5ff4SAndreas Gohr * Date: 3/30/15
23*269d5ff4SAndreas Gohr * Time: 2:42 PM
24*269d5ff4SAndreas Gohr */
25*269d5ff4SAndreas Gohr
26*269d5ff4SAndreas Gohrnamespace Tx\Mailer\Exceptions;
27*269d5ff4SAndreas Gohr
28*269d5ff4SAndreas Gohr
29*269d5ff4SAndreas Gohrclass CodeException extends SMTPException
30*269d5ff4SAndreas Gohr{
31*269d5ff4SAndreas Gohr    public function __construct($expected, $received, $serverMessage = null)
32*269d5ff4SAndreas Gohr    {
33*269d5ff4SAndreas Gohr        $message = "Unexpected return code - Expected: {$expected}, Got: {$received}";
34*269d5ff4SAndreas Gohr        if (isset($serverMessage)) {
35*269d5ff4SAndreas Gohr            $message .= " | " . $serverMessage;
36*269d5ff4SAndreas Gohr        }
37*269d5ff4SAndreas Gohr        parent::__construct($message);
38*269d5ff4SAndreas Gohr    }
39*269d5ff4SAndreas Gohr
40*269d5ff4SAndreas Gohr}
41