Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * This file is part of SwiftMailer.
  5. * (c) 2004-2009 Chris Corbyn
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10.  
  11. /**
  12. * Generated when a message is being sent.
  13. *
  14. * @author Chris Corbyn
  15. */
  16. class Swift_Events_SendEvent extends Swift_Events_EventObject
  17. {
  18. /** Sending has yet to occur */
  19. const RESULT_PENDING = 0x0001;
  20.  
  21. /** Email is spooled, ready to be sent */
  22. const RESULT_SPOOLED = 0x0011;
  23.  
  24. /** Sending was successful */
  25. const RESULT_SUCCESS = 0x0010;
  26.  
  27. /** Sending worked, but there were some failures */
  28. const RESULT_TENTATIVE = 0x0100;
  29.  
  30. /** Sending failed */
  31. const RESULT_FAILED = 0x1000;
  32.  
  33. /**
  34. * The Message being sent.
  35. *
  36. * @var Swift_Mime_Message
  37. */
  38. private $_message;
  39.  
  40. /**
  41. * Any recipients which failed after sending.
  42. *
  43. * @var string[]
  44. */
  45. private $_failedRecipients = array();
  46.  
  47. /**
  48. * The overall result as a bitmask from the class constants.
  49. *
  50. * @var int
  51. */
  52. private $_result;
  53.  
  54. /**
  55. * Create a new SendEvent for $source and $message.
  56. *
  57. * @param Swift_Transport $source
  58. * @param Swift_Mime_Message $message
  59. */
  60. public function __construct(Swift_Transport $source, Swift_Mime_Message $message)
  61. {
  62. parent::__construct($source);
  63. $this->_message = $message;
  64. $this->_result = self::RESULT_PENDING;
  65. }
  66.  
  67. /**
  68. * Get the Transport used to send the Message.
  69. *
  70. * @return Swift_Transport
  71. */
  72. public function getTransport()
  73. {
  74. return $this->getSource();
  75. }
  76.  
  77. /**
  78. * Get the Message being sent.
  79. *
  80. * @return Swift_Mime_Message
  81. */
  82. public function getMessage()
  83. {
  84. return $this->_message;
  85. }
  86.  
  87. /**
  88. * Set the array of addresses that failed in sending.
  89. *
  90. * @param array $recipients
  91. */
  92. public function setFailedRecipients($recipients)
  93. {
  94. $this->_failedRecipients = $recipients;
  95. }
  96.  
  97. /**
  98. * Get an recipient addresses which were not accepted for delivery.
  99. *
  100. * @return string[]
  101. */
  102. public function getFailedRecipients()
  103. {
  104. return $this->_failedRecipients;
  105. }
  106.  
  107. /**
  108. * Set the result of sending.
  109. *
  110. * @param int $result
  111. */
  112. public function setResult($result)
  113. {
  114. $this->_result = $result;
  115. }
  116.  
  117. /**
  118. * Get the result of this Event.
  119. *
  120. * The return value is a bitmask from
  121. * {@see RESULT_PENDING, RESULT_SUCCESS, RESULT_TENTATIVE, RESULT_FAILED}
  122. *
  123. * @return int
  124. */
  125. public function getResult()
  126. {
  127. return $this->_result;
  128. }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement