Allow templating of email subjects

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-09-15 10:51:55 +02:00
parent 8e884ba52f
commit f109c1a10c
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with 38 additions and 0 deletions

View File

@ -50,6 +50,8 @@ class EMailTemplate implements IEMailTemplate {
/** @var array */
protected $data;
/** @var string */
protected $subject = '';
/** @var string */
protected $htmlBody = '';
/** @var string */
@ -358,6 +360,15 @@ EOF;
$this->data = $data;
}
/**
* Sets the subject of the email
*
* @param string $subject
*/
public function setSubject($subject) {
$this->subject = $subject;
}
/**
* Adds a header to the email
*/
@ -595,6 +606,15 @@ EOF;
$this->plainBody .= str_replace('<br>', PHP_EOL, $text);
}
/**
* Returns the rendered email subject as string
*
* @return string
*/
public function renderSubject() {
return $this->subject;
}
/**
* Returns the rendered HTML email as string
*

View File

@ -52,6 +52,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
*
@ -130,6 +139,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
*