1
0

IMessage.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Mail;
  8. /**
  9. * Interface IMessage
  10. *
  11. * @since 13.0.0
  12. */
  13. interface IMessage {
  14. /**
  15. * Set the subject of this message
  16. *
  17. * @param string $subject
  18. *
  19. * @return self
  20. * @since 28.0.0
  21. */
  22. public function setSubject(string $subject): IMessage;
  23. /**
  24. * Set the plain-text body of this message
  25. *
  26. * @param string $body
  27. *
  28. * @return self
  29. * @since 28.0.0
  30. */
  31. public function setPlainBody(string $body): IMessage;
  32. /**
  33. * Set the HTML body of this message. Consider also sending a plain-text body instead of only an HTML one.
  34. *
  35. * @param string $body
  36. *
  37. * @return self
  38. * @since 28.0.0
  39. */
  40. public function setHtmlBody(string $body): IMessage;
  41. /**
  42. * @param IAttachment $attachment
  43. * @return IMessage
  44. * @since 13.0.0
  45. */
  46. public function attach(IAttachment $attachment): IMessage;
  47. /**
  48. * Can be used to "attach content inline" as message parts with specific MIME type and encoding.
  49. *
  50. * @param string $body body of the MIME part
  51. * @param string $name the file name
  52. * @param string|null $contentType MIME Content-Type (e.g. text/plain or text/calendar)
  53. *
  54. * @return IMessage
  55. * @since 27.0.0
  56. */
  57. public function attachInline(string $body, string $name, ?string $contentType = null): IMessage;
  58. /**
  59. * Set the from address of this message.
  60. *
  61. * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php
  62. *
  63. * @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name')
  64. * @return IMessage
  65. * @since 13.0.0
  66. */
  67. public function setFrom(array $addresses): IMessage;
  68. /**
  69. * Set the Reply-To address of this message
  70. *
  71. * @param array $addresses
  72. * @return IMessage
  73. * @since 13.0.0
  74. */
  75. public function setReplyTo(array $addresses): IMessage;
  76. /**
  77. * Set the to addresses of this message.
  78. *
  79. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  80. * @return IMessage
  81. * @since 13.0.0
  82. */
  83. public function setTo(array $recipients): IMessage;
  84. /**
  85. * Set the CC recipients of this message.
  86. *
  87. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  88. * @return IMessage
  89. * @since 13.0.0
  90. */
  91. public function setCc(array $recipients): IMessage;
  92. /**
  93. * Set the BCC recipients of this message.
  94. *
  95. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  96. * @return IMessage
  97. * @since 13.0.0
  98. */
  99. public function setBcc(array $recipients): IMessage;
  100. /**
  101. * @param IEMailTemplate $emailTemplate
  102. * @return IMessage
  103. * @since 13.0.0
  104. */
  105. public function useTemplate(IEMailTemplate $emailTemplate): IMessage;
  106. /**
  107. * Add the Auto-Submitted header to the email, preventing most automated
  108. * responses to automated messages.
  109. *
  110. * @param Headers\AutoSubmitted::VALUE_* $value (one of AutoSubmitted::VALUE_NO, AutoSubmitted::VALUE_AUTO_GENERATED, AutoSubmitted::VALUE_AUTO_REPLIED)
  111. * @return IMessage
  112. * @since 26.0.0
  113. */
  114. public function setAutoSubmitted(string $value): IMessage;
  115. }