Commit 973daa40 authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Adding method to use predefined values for the new fields

parent 1593f6e6
......@@ -259,6 +259,32 @@ class MailTemplateService {
return self::$registerArray;
}
/**
* Sets the predefined values for this template, supplied by the Editor, if possible
* values for cc, bcc, replyTo, fromMail and fromName
*
* @param string $extensionKey
* @param string $templateName
* @param string $language
* @return bool
*/
public function loadPredefinedValuesForTemplate($extensionKey, $templateName, $language) {
/** @var Template $template */
$template = $this->templateRepository->findOneByTemplate(
$this->extensionKey, $this->templateName, $this->language
);
if ($template !== NULL) {
$this->setCcAddresses(explode(',', $template->getCc()));
$this->setBccAddresses(explode(',', $template->getBcc()));
$this->setReplyToAddress($template->getReplyTo());
$this->setFromAddress($template->getFromMail(), $template->getFromName());
return true;
}
return false;
}
/**
* Send the Email
*
......@@ -389,11 +415,12 @@ class MailTemplateService {
/**
* @param string $fromAddress
* @param string $fromName
* @return MailTemplateService
*/
public function setFromAddress($fromAddress) {
public function setFromAddress($fromAddress, $fromName = '') {
$this->fromAddress = $fromAddress;
$this->mailMessage->setFrom($fromAddress);
$this->mailMessage->setFrom($fromAddress, $fromName);
return $this;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment