Message.php 6.0KB

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