summaryrefslogtreecommitdiff
path: root/src/Mail/EngelsystemMailer.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mail/EngelsystemMailer.php')
-rw-r--r--src/Mail/EngelsystemMailer.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Mail/EngelsystemMailer.php b/src/Mail/EngelsystemMailer.php
index 17047cc8..81660681 100644
--- a/src/Mail/EngelsystemMailer.php
+++ b/src/Mail/EngelsystemMailer.php
@@ -10,6 +10,13 @@ class EngelsystemMailer extends Mailer
/** @var Renderer|null */
protected $view;
+ /** @var string */
+ protected $subjectPrefix = null;
+
+ /**
+ * @param SwiftMailer $mailer
+ * @param Renderer $view
+ */
public function __construct(SwiftMailer $mailer, Renderer $view = null)
{
parent::__construct($mailer);
@@ -32,4 +39,37 @@ class EngelsystemMailer extends Mailer
return $this->send($to, $subject, $body);
}
+
+ /**
+ * Send the mail
+ *
+ * @param string|string[] $to
+ * @param string $subject
+ * @param string $body
+ * @return int
+ */
+ public function send($to, string $subject, string $body): int
+ {
+ if ($this->subjectPrefix) {
+ $subject = sprintf('[%s] %s', $this->subjectPrefix, $subject);
+ }
+
+ return parent::send($to, $subject, $body);
+ }
+
+ /**
+ * @return string
+ */
+ public function getSubjectPrefix(): string
+ {
+ return $this->subjectPrefix;
+ }
+
+ /**
+ * @param string $subjectPrefix
+ */
+ public function setSubjectPrefix(string $subjectPrefix)
+ {
+ $this->subjectPrefix = $subjectPrefix;
+ }
}