Message.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?php
  2. /*
  3. * This file is part of SwiftMailer.
  4. * (c) 2004-2009 Chris Corbyn
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * A Message (RFC 2822) object.
  11. *
  12. * @author Chris Corbyn
  13. */
  14. interface Swift_Mime_Message extends Swift_Mime_MimeEntity
  15. {
  16. /**
  17. * Generates a valid Message-ID and switches to it.
  18. *
  19. * @return string
  20. */
  21. public function generateId();
  22. /**
  23. * Set the subject of the message.
  24. *
  25. * @param string $subject
  26. */
  27. public function setSubject($subject);
  28. /**
  29. * Get the subject of the message.
  30. *
  31. * @return string
  32. */
  33. public function getSubject();
  34. /**
  35. * Set the origination date of the message as a UNIX timestamp.
  36. *
  37. * @param int $date
  38. */
  39. public function setDate($date);
  40. /**
  41. * Get the origination date of the message as a UNIX timestamp.
  42. *
  43. * @return int
  44. */
  45. public function getDate();
  46. /**
  47. * Set the return-path (bounce-detect) address.
  48. *
  49. * @param string $address
  50. */
  51. public function setReturnPath($address);
  52. /**
  53. * Get the return-path (bounce-detect) address.
  54. *
  55. * @return string
  56. */
  57. public function getReturnPath();
  58. /**
  59. * Set the sender of this message.
  60. *
  61. * If multiple addresses are present in the From field, this SHOULD be set.
  62. *
  63. * According to RFC 2822 it is a requirement when there are multiple From
  64. * addresses, but Swift itself does not require it directly.
  65. *
  66. * An associative array (with one element!) can be used to provide a display-
  67. * name: i.e. array('email@address' => 'Real Name').
  68. *
  69. * If the second parameter is provided and the first is a string, then $name
  70. * is associated with the address.
  71. *
  72. * @param mixed $address
  73. * @param string $name optional
  74. */
  75. public function setSender($address, $name = null);
  76. /**
  77. * Get the sender address for this message.
  78. *
  79. * This has a higher significance than the From address.
  80. *
  81. * @return string
  82. */
  83. public function getSender();
  84. /**
  85. * Set the From address of this message.
  86. *
  87. * It is permissible for multiple From addresses to be set using an array.
  88. *
  89. * If multiple From addresses are used, you SHOULD set the Sender address and
  90. * according to RFC 2822, MUST set the sender address.
  91. *
  92. * An array can be used if display names are to be provided: i.e.
  93. * array('email@address.com' => 'Real Name').
  94. *
  95. * If the second parameter is provided and the first is a string, then $name
  96. * is associated with the address.
  97. *
  98. * @param mixed $addresses
  99. * @param string $name optional
  100. */
  101. public function setFrom($addresses, $name = null);
  102. /**
  103. * Get the From address(es) of this message.
  104. *
  105. * This method always returns an associative array where the keys are the
  106. * addresses.
  107. *
  108. * @return string[]
  109. */
  110. public function getFrom();
  111. /**
  112. * Set the Reply-To address(es).
  113. *
  114. * Any replies from the receiver will be sent to this address.
  115. *
  116. * It is permissible for multiple reply-to addresses to be set using an array.
  117. *
  118. * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.
  119. *
  120. * If the second parameter is provided and the first is a string, then $name
  121. * is associated with the address.
  122. *
  123. * @param mixed $addresses
  124. * @param string $name optional
  125. */
  126. public function setReplyTo($addresses, $name = null);
  127. /**
  128. * Get the Reply-To addresses for this message.
  129. *
  130. * This method always returns an associative array where the keys provide the
  131. * email addresses.
  132. *
  133. * @return string[]
  134. */
  135. public function getReplyTo();
  136. /**
  137. * Set the To address(es).
  138. *
  139. * Recipients set in this field will receive a copy of this message.
  140. *
  141. * This method has the same synopsis as {@link setFrom()} and {@link setCc()}.
  142. *
  143. * If the second parameter is provided and the first is a string, then $name
  144. * is associated with the address.
  145. *
  146. * @param mixed $addresses
  147. * @param string $name optional
  148. */
  149. public function setTo($addresses, $name = null);
  150. /**
  151. * Get the To addresses for this message.
  152. *
  153. * This method always returns an associative array, whereby the keys provide
  154. * the actual email addresses.
  155. *
  156. * @return string[]
  157. */
  158. public function getTo();
  159. /**
  160. * Set the Cc address(es).
  161. *
  162. * Recipients set in this field will receive a 'carbon-copy' of this message.
  163. *
  164. * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.
  165. *
  166. * @param mixed $addresses
  167. * @param string $name optional
  168. */
  169. public function setCc($addresses, $name = null);
  170. /**
  171. * Get the Cc addresses for this message.
  172. *
  173. * This method always returns an associative array, whereby the keys provide
  174. * the actual email addresses.
  175. *
  176. * @return string[]
  177. */
  178. public function getCc();
  179. /**
  180. * Set the Bcc address(es).
  181. *
  182. * Recipients set in this field will receive a 'blind-carbon-copy' of this
  183. * message.
  184. *
  185. * In other words, they will get the message, but any other recipients of the
  186. * message will have no such knowledge of their receipt of it.
  187. *
  188. * This method has the same synopsis as {@link setFrom()} and {@link setTo()}.
  189. *
  190. * @param mixed $addresses
  191. * @param string $name optional
  192. */
  193. public function setBcc($addresses, $name = null);
  194. /**
  195. * Get the Bcc addresses for this message.
  196. *
  197. * This method always returns an associative array, whereby the keys provide
  198. * the actual email addresses.
  199. *
  200. * @return string[]
  201. */
  202. public function getBcc();
  203. }