1<?php 2 3/** 4 * Swift Mailer Send Event 5 * Please read the LICENSE file 6 * @copyright Chris Corbyn <chris@w3style.co.uk> 7 * @author Chris Corbyn <chris@w3style.co.uk> 8 * @package Swift_Events 9 * @license GNU Lesser General Public License 10 */ 11 12 13/** 14 * Generated every time a message is sent with Swift 15 * @package Swift_Events 16 * @author Chris Corbyn <chris@w3style.co.uk> 17 */ 18class Swift_Events_SendEvent extends Swift_Events 19{ 20 /** 21 * A reference to the message being sent 22 * @var Swift_Message 23 */ 24 protected $message = null; 25 /** 26 * A reference to the sender address object 27 * @var Swift_Address 28 */ 29 protected $sender = null; 30 /** 31 * A reference to the recipients being sent to 32 * @var Swift_RecipientList 33 */ 34 protected $recipients = null; 35 /** 36 * The number of recipients sent to so 37 * @var int 38 */ 39 protected $sent = null; 40 /** 41 * Recipients we couldn't send to 42 * @var array 43 */ 44 protected $failed = array(); 45 46 /** 47 * Constructor 48 * @param Swift_Message The message being sent 49 * @param Swift_RecipientList The recipients 50 * @param Swift_Address The sender address 51 * @param int The number of addresses sent to 52 */ 53 public function __construct(Swift_Message $message, Swift_RecipientList $list, Swift_Address $from, $sent=0) 54 { 55 $this->message = $message; 56 $this->recipients = $list; 57 $this->sender = $from; 58 $this->sent = $sent; 59 } 60 /** 61 * Get the message being sent 62 * @return Swift_Message 63 */ 64 public function getMessage() 65 { 66 return $this->message; 67 } 68 /** 69 * Get the list of recipients 70 * @return Swift_RecipientList 71 */ 72 public function getRecipients() 73 { 74 return $this->recipients; 75 } 76 /** 77 * Get the sender's address 78 * @return Swift_Address 79 */ 80 public function getSender() 81 { 82 return $this->sender; 83 } 84 /** 85 * Set the number of recipients to how many were sent 86 * @param int 87 */ 88 public function setNumSent($sent) 89 { 90 $this->sent = (int) $sent; 91 } 92 /** 93 * Get the total number of addresses to which the email sent successfully 94 * @return int 95 */ 96 public function getNumSent() 97 { 98 return $this->sent; 99 } 100 /** 101 * Add an email address to the failed recipient list for this send 102 * @var string The email address 103 */ 104 public function addFailedRecipient($address) 105 { 106 $this->failed[] = $address; 107 } 108 /** 109 * Get an array of failed recipients for this send 110 * @return array 111 */ 112 public function getFailedRecipients() 113 { 114 return $this->failed; 115 } 116} 117