1
0

IMessage.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. * @param IAttachment $attachment
  34. * @return IMessage
  35. * @since 13.0.0
  36. */
  37. public function attach(IAttachment $attachment): IMessage;
  38. /**
  39. * Can be used to "attach content inline" as message parts with specific MIME type and encoding.
  40. *
  41. * @param string $body body of the MIME part
  42. * @param string $name the file name
  43. * @param string|null $contentType MIME Content-Type (e.g. text/plain or text/calendar)
  44. *
  45. * @return IMessage
  46. * @since 26.0.0
  47. */
  48. public function attachInline(string $body, string $name, string $contentType = null): IMessage;
  49. /**
  50. * Set the from address of this message.
  51. *
  52. * If no "From" address is used \OC\Mail\Mailer will use mail_from_address and mail_domain from config.php
  53. *
  54. * @param array $addresses Example: array('sender@domain.org', 'other@domain.org' => 'A name')
  55. * @return IMessage
  56. * @since 13.0.0
  57. */
  58. public function setFrom(array $addresses): IMessage;
  59. /**
  60. * Set the Reply-To address of this message
  61. *
  62. * @param array $addresses
  63. * @return IMessage
  64. * @since 13.0.0
  65. */
  66. public function setReplyTo(array $addresses): IMessage;
  67. /**
  68. * Set the to addresses of this message.
  69. *
  70. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  71. * @return IMessage
  72. * @since 13.0.0
  73. */
  74. public function setTo(array $recipients): IMessage;
  75. /**
  76. * Set the CC recipients of this message.
  77. *
  78. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  79. * @return IMessage
  80. * @since 13.0.0
  81. */
  82. public function setCc(array $recipients): IMessage;
  83. /**
  84. * Set the BCC recipients of this message.
  85. *
  86. * @param array $recipients Example: array('recipient@domain.org', 'other@domain.org' => 'A name')
  87. * @return IMessage
  88. * @since 13.0.0
  89. */
  90. public function setBcc(array $recipients): IMessage;
  91. /**
  92. * @param IEMailTemplate $emailTemplate
  93. * @return IMessage
  94. * @since 13.0.0
  95. */
  96. public function useTemplate(IEMailTemplate $emailTemplate): IMessage;
  97. /**
  98. * Add the Auto-Submitted header to the email, preventing most automated
  99. * responses to automated messages.
  100. *
  101. * @param Headers\AutoSubmitted::VALUE_* $value (one of AutoSubmitted::VALUE_NO, AutoSubmitted::VALUE_AUTO_GENERATED, AutoSubmitted::VALUE_AUTO_REPLIED)
  102. * @return IMessage
  103. * @since 26.0.0
  104. */
  105. public function setAutoSubmitted(string $value): IMessage;
  106. }