Merge branch 'maint/7.0'
[ninja.git] / application / vendor / swiftmailer / classes / Swift / Events / SendEvent.php
blob49a835135547d4186644b17f03eb01cd49ca05e9
1 <?php
3 /*
4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
11 //@require 'Swift/Events/EventObject.php';
13 /**
14 * Generated when a message is being sent.
15 * @package Swift
16 * @subpackage Events
17 * @author Chris Corbyn
19 class Swift_Events_SendEvent extends Swift_Events_EventObject
22 /** Sending has yet to occur */
23 const RESULT_PENDING = 0x0001;
25 /** Sending was successful */
26 const RESULT_SUCCESS = 0x0010;
28 /** Sending worked, but there were some failures */
29 const RESULT_TENTATIVE = 0x0100;
31 /** Sending failed */
32 const RESULT_FAILED = 0x1000;
34 /**
35 * The Message being sent.
36 * @var Swift_Mime_Message
38 private $_message;
40 /**
41 * The Transport used in sending.
42 * @var Swift_Transport
44 private $_transport;
46 /**
47 * Any recipients which failed after sending.
48 * @var string[]
50 private $failedRecipients = array();
52 /**
53 * The overall result as a bitmask from the class constants.
54 * @var int
56 private $result;
58 /**
59 * Create a new SendEvent for $source and $message.
60 * @param Swift_Transport $source
61 * @param Swift_Mime_Message $message
63 public function __construct(Swift_Transport $source,
64 Swift_Mime_Message $message)
66 parent::__construct($source);
67 $this->_message = $message;
68 $this->_result = self::RESULT_PENDING;
71 /**
72 * Get the Transport used to send the Message.
73 * @return Swift_Transport
75 public function getTransport()
77 return $this->getSource();
80 /**
81 * Get the Message being sent.
82 * @return Swift_Mime_Message
84 public function getMessage()
86 return $this->_message;
89 /**
90 * Set the array of addresses that failed in sending.
91 * @param array $recipients
93 public function setFailedRecipients($recipients)
95 $this->_failedRecipients = $recipients;
98 /**
99 * Get an recipient addresses which were not accepted for delivery.
100 * @return string[]
102 public function getFailedRecipients()
104 return $this->_failedRecipients;
108 * Set the result of sending.
109 * @return int
111 public function setResult($result)
113 $this->_result = $result;
117 * Get the result of this Event.
118 * The return value is a bitmask from
119 * {@link RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}
120 * @return int
122 public function getResult()
124 return $this->_result;