Message.php 5.6KB

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