/**
* Builder for notification emails (notification, source, links, ...)
*/
-class NotifyMailBuilder extends SystemMailBuilder
+class NotifyMailBuilder extends MailBuilder
{
+ /** @var string */
+ protected $subject;
+ /** @var string */
+ protected $preamble;
+ /** @var string */
+ protected $body;
+
+ /** @var string */
+ protected $siteAdmin;
+
/** @var bool */
private $contentAllowed = true;
/** @var string */
public function __construct(L10n $l10n, BaseURL $baseUrl, IConfig $config, string $siteEmailAddress, string $siteName)
{
- parent::__construct($l10n, $baseUrl, $config, $siteEmailAddress, $siteName);
+ parent::__construct($l10n, $baseUrl, $config);
+
+ if ($this->config->get('config', 'admin_name')) {
+ $this->siteAdmin = $l10n->t('%1$s, %2$s Administrator', $this->config->get('config', 'admin_name'), $siteName);
+ } else {
+ $this->siteAdmin = $l10n->t('%s Administrator', $siteName);
+ }
+
+ // Set the system wide site address/name as sender (default for system mails)
+ $this->withSender($siteName, $siteEmailAddress, $siteEmailAddress);
// check whether sending post content in email notifications is allowed
$this->contentAllowed = $this->config->get('system', 'enotify_no_content');
*/
public function withNotification(string $subject, string $preamble, string $title, string $body = null)
{
+ if (!isset($body)) {
+ $body = $preamble;
+ }
+
$this->title = stripslashes($title);
+ $this->subject = $subject;
+ $this->preamble = $preamble;
+ $this->body = $body;
- return $this->withMessage($subject, $preamble, $body);
+ return $this;
}
/**
*
* @see Notify
*
- * @param L10n $l10n The chosen language for the new email
- *
* @return NotifyMailBuilder
*/
- public function newNotifyMail(L10n $l10n)
+ public function newNotifyMail()
{
- return new NotifyMailBuilder($l10n, $this->baseUrl, $this->config,
+ return new NotifyMailBuilder($this->l10n, $this->baseUrl, $this->config,
$this->getSiteEmailAddress(), $this->getSiteEmailName());
}