summaryrefslogtreecommitdiffstats
path: root/lib/private/Mail/Message.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-09-15 10:55:27 +0200
committerJoas Schilling <coding@schilljs.com>2017-10-18 15:12:03 +0200
commitc9af36a9ab05e808df526a2054c30364ee02241c (patch)
tree39c49dd14c53467c64685e6a154971997afa1d20 /lib/private/Mail/Message.php
parent8b37fe7f6534ad16bd9a357036e95e748e2068e3 (diff)
downloadnextcloud-server-c9af36a9ab05e808df526a2054c30364ee02241c.tar.gz
nextcloud-server-c9af36a9ab05e808df526a2054c30364ee02241c.zip
Introduce a public interface for Message
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Mail/Message.php')
-rw-r--r--lib/private/Mail/Message.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index 2d3c49d0ce1..b4d1e4dbe7a 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -23,6 +23,8 @@
namespace OC\Mail;
+use OCP\Mail\IEMailTemplate;
+use OCP\Mail\IMessage;
use Swift_Message;
/**
@@ -30,7 +32,7 @@ use Swift_Message;
*
* @package OC\Mail
*/
-class Message {
+class Message implements IMessage {
/** @var Swift_Message */
private $swiftMessage;
@@ -250,4 +252,15 @@ class Message {
$this->swiftMessage->setBody($body, $contentType);
return $this;
}
+
+ /**
+ * @param IEMailTemplate $emailTemplate
+ * @return $this
+ */
+ public function useTemplate(IEMailTemplate $emailTemplate) {
+ $this->setSubject($emailTemplate->renderSubject());
+ $this->setPlainBody($emailTemplate->renderText());
+ $this->setHtmlBody($emailTemplate->renderHtml());
+ return $this;
+ }
}