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.
11 //@require 'Swift/Events/EventObject.php';
14 * Generated when a message is being sent.
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;
32 const RESULT_FAILED
= 0x1000;
35 * The Message being sent.
36 * @var Swift_Mime_Message
41 * The Transport used in sending.
42 * @var Swift_Transport
47 * Any recipients which failed after sending.
50 private $failedRecipients = array();
53 * The overall result as a bitmask from the class constants.
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
;
72 * Get the Transport used to send the Message.
73 * @return Swift_Transport
75 public function getTransport()
77 return $this->getSource();
81 * Get the Message being sent.
82 * @return Swift_Mime_Message
84 public function getMessage()
86 return $this->_message
;
90 * Set the array of addresses that failed in sending.
91 * @param array $recipients
93 public function setFailedRecipients($recipients)
95 $this->_failedRecipients
= $recipients;
99 * Get an recipient addresses which were not accepted for delivery.
102 public function getFailedRecipients()
104 return $this->_failedRecipients
;
108 * Set the result of sending.
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}
122 public function getResult()
124 return $this->_result
;