Expose to the user interface the email sender address
This commit is contained in:
@@ -32,7 +32,7 @@ class Mail extends Base implements ClientInterface
|
|||||||
try {
|
try {
|
||||||
$message = Swift_Message::newInstance()
|
$message = Swift_Message::newInstance()
|
||||||
->setSubject($subject)
|
->setSubject($subject)
|
||||||
->setFrom(array(MAIL_FROM => $author))
|
->setFrom(array($this->helper->mail->getMailSenderAddress() => $author))
|
||||||
->setBody($html, 'text/html')
|
->setBody($html, 'text/html')
|
||||||
->setTo(array($email => $name));
|
->setTo(array($email => $name));
|
||||||
|
|
||||||
|
|||||||
@@ -45,4 +45,21 @@ class MailHelper extends Base
|
|||||||
|
|
||||||
return $subject;
|
return $subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get mail sender address
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getMailSenderAddress()
|
||||||
|
{
|
||||||
|
$email = $this->configModel->get('mail_sender_address');
|
||||||
|
|
||||||
|
if (!empty($email)) {
|
||||||
|
return $email;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MAIL_FROM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@
|
|||||||
<?= $this->form->text('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?>
|
<?= $this->form->text('application_url', $values, $errors, array('placeholder="http://example.kanboard.net/"')) ?>
|
||||||
<p class="form-help"><?= t('Example: http://example.kanboard.net/ (used to generate absolute URLs)') ?></p>
|
<p class="form-help"><?= t('Example: http://example.kanboard.net/ (used to generate absolute URLs)') ?></p>
|
||||||
|
|
||||||
|
<?= $this->form->label(t('Email sender address'), 'mail_sender_address') ?>
|
||||||
|
<?= $this->form->text('mail_sender_address', $values, $errors, array('placeholder="'.MAIL_FROM.'"')) ?>
|
||||||
|
|
||||||
<?= $this->form->label(t('Language'), 'application_language') ?>
|
<?= $this->form->label(t('Language'), 'application_language') ?>
|
||||||
<?= $this->form->select('application_language', $languages, $values, $errors) ?>
|
<?= $this->form->select('application_language', $languages, $values, $errors) ?>
|
||||||
|
|
||||||
|
|||||||
@@ -21,4 +21,15 @@ class MailHelperTest extends Base
|
|||||||
$this->assertEquals('Test', $helper->filterSubject('RE: Test'));
|
$this->assertEquals('Test', $helper->filterSubject('RE: Test'));
|
||||||
$this->assertEquals('Test', $helper->filterSubject('FW: Test'));
|
$this->assertEquals('Test', $helper->filterSubject('FW: Test'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testGetSenderAddress()
|
||||||
|
{
|
||||||
|
$helper = new MailHelper($this->container);
|
||||||
|
$this->assertEquals('notifications@kanboard.local', $helper->getMailSenderAddress());
|
||||||
|
|
||||||
|
$this->container['configModel']->save(array('mail_sender_address' => 'me@here'));
|
||||||
|
$this->container['memoryCache']->flush();
|
||||||
|
|
||||||
|
$this->assertEquals('me@here', $helper->getMailSenderAddress());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user