summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-09-15 10:51:55 +0200
committerJoas Schilling <coding@schilljs.com>2017-10-18 15:12:00 +0200
commitf109c1a10c9f5acf0d5d3e4f864e3702f99db937 (patch)
tree659c38f43f8c3a9b27e78f90c7be73c5af5fc008
parent8e884ba52fe3796d0da1e108a7a8fb1b43e6d554 (diff)
downloadnextcloud-server-f109c1a10c9f5acf0d5d3e4f864e3702f99db937.tar.gz
nextcloud-server-f109c1a10c9f5acf0d5d3e4f864e3702f99db937.zip
Allow templating of email subjects
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--lib/private/Mail/EMailTemplate.php20
-rw-r--r--lib/public/Mail/IEMailTemplate.php18
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php
index da3341b6709..e4e28a9294e 100644
--- a/lib/private/Mail/EMailTemplate.php
+++ b/lib/private/Mail/EMailTemplate.php
@@ -51,6 +51,8 @@ class EMailTemplate implements IEMailTemplate {
protected $data;
/** @var string */
+ protected $subject = '';
+ /** @var string */
protected $htmlBody = '';
/** @var string */
protected $plainBody = '';
@@ -359,6 +361,15 @@ EOF;
}
/**
+ * Sets the subject of the email
+ *
+ * @param string $subject
+ */
+ public function setSubject($subject) {
+ $this->subject = $subject;
+ }
+
+ /**
* Adds a header to the email
*/
public function addHeader() {
@@ -596,6 +607,15 @@ EOF;
}
/**
+ * Returns the rendered email subject as string
+ *
+ * @return string
+ */
+ public function renderSubject() {
+ return $this->subject;
+ }
+
+ /**
* Returns the rendered HTML email as string
*
* @return string
diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php
index 04a3905c2e3..c1766076c44 100644
--- a/lib/public/Mail/IEMailTemplate.php
+++ b/lib/public/Mail/IEMailTemplate.php
@@ -53,6 +53,15 @@ namespace OCP\Mail;
interface IEMailTemplate {
/**
+ * Sets the subject of the email
+ *
+ * @param string $subject
+ *
+ * @since 13.0.0
+ */
+ public function setSubject($subject);
+
+ /**
* Adds a header to the email
*
* @since 12.0.0
@@ -131,6 +140,15 @@ interface IEMailTemplate {
public function addFooter($text = '');
/**
+ * Returns the rendered email subject as string
+ *
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function renderSubject();
+
+ /**
* Returns the rendered HTML email as string
*
* @return string