1
0

IMessage.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
  5. *
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OCP\Mail;
  26. /**
  27. * Interface IMessage
  28. *
  29. * @since 13.0.0
  30. */
  31. interface IMessage {
  32. /**
  33. * Set the subject of this message
  34. *
  35. * @param string $subject
  36. *
  37. * @return self
  38. * @since 28.0.0
  39. */
  40. public function setSubject(string $subject): IMessage;
  41. /**
  42. * Set the plain-text body of this message
  43. *
  44. * @param string $body
  45. *
  46. * @return self
  47. * @since 28.0.0
  48. */
  49. public function setPlainBody(string $body): IMessage;
  50. /**
  51. * Set the HTML body of this message. Consider also sending a plain-text body instead of only an HTML one.
  52. *
  53. * @param string $body
  54. *
  55. * @return self
  56. * @since 28.0.0
  57. */
  58. public function setHtmlBody(string $body): IMessage;
  59. /**
  60. * @param IAttachment $attachment
  61. * @return IMessage
  62. * @since 13.0.0
  63. */
  64. public function attach(IAttachment $attachment): IMessage;
  65. /**
  66. * Can be used to "attach content inline" as message parts with specific MIME type and encoding.
  67. *
  68. * @param string $body body of the MIME part
  69. * @param string $name the file name
  70. * @param string|null $contentType MIME Content-Type (e.g. text/plain or text/calendar)
  71. *
  72. * @return IMessage
  73. * @since 27.0.0
  74. */
  75. public function attachInline(string $body, string $name, string $contentType = null): IMessage;
  76. /**
  77. * Set the from address of this message.
  78. *
  79. * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php
  80. *
  81. * @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name')
  82. * @return IMessage
  83. * @since 13.0.0
  84. */
  85. public function setFrom(array $addresses): IMessage;
  86. /**
  87. * Set the Reply-To address of this message
  88. *
  89. * @param array $addresses
  90. * @return IMessage
  91. * @since 13.0.0
  92. */
  93. public function setReplyTo(array $addresses): IMessage;
  94. /**
  95. * Set the to addresses of this message.
  96. *
  97. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  98. * @return IMessage
  99. * @since 13.0.0
  100. */
  101. public function setTo(array $recipients): IMessage;
  102. /**
  103. * Set the CC recipients of this message.
  104. *
  105. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  106. * @return IMessage
  107. * @since 13.0.0
  108. */
  109. public function setCc(array $recipients): IMessage;
  110. /**
  111. * Set the BCC recipients of this message.
  112. *
  113. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  114. * @return IMessage
  115. * @since 13.0.0
  116. */
  117. public function setBcc(array $recipients): IMessage;
  118. /**
  119. * @param IEMailTemplate $emailTemplate
  120. * @return IMessage
  121. * @since 13.0.0
  122. */
  123. public function useTemplate(IEMailTemplate $emailTemplate): IMessage;
  124. /**
  125. * Add the Auto-Submitted header to the email, preventing most automated
  126. * responses to automated messages.
  127. *
  128. * @param Headers\AutoSubmitted::VALUE_* $value (one of AutoSubmitted::VALUE_NO, AutoSubmitted::VALUE_AUTO_GENERATED, AutoSubmitted::VALUE_AUTO_REPLIED)
  129. * @return IMessage
  130. * @since 26.0.0
  131. */
  132. public function setAutoSubmitted(string $value): IMessage;
  133. }