mirror of
https://github.com/humhub/humhub.git
synced 2025-02-06 08:19:03 +01:00
parent
a232c1ef37
commit
5e8d93d5f5
@ -3,3 +3,4 @@
|
||||
|
||||
- Fix #5434: Hide disabled next/prev buttons on guide first/last steps
|
||||
- Fix #5456: `canImpersonate` only possible for SystemAdmins
|
||||
- Enh #5224: Add reply-to email in the settings
|
||||
|
@ -80,6 +80,9 @@ class Mailer extends \yii\swiftmailer\Mailer
|
||||
// Set HumHub default from values
|
||||
if (empty($message->getFrom())) {
|
||||
$message->setFrom([Yii::$app->settings->get('mailer.systemEmailAddress') => Yii::$app->settings->get('mailer.systemEmailName')]);
|
||||
if ($replyTo = Yii::$app->settings->get('mailer.systemEmailReplyTo')) {
|
||||
$message->setReplyTo($replyTo);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->signingCertificatePath !== null && $this->signingPrivateKeyPath !== null) {
|
||||
|
@ -140,6 +140,8 @@ class Setting extends ActiveRecord
|
||||
return ['mailer.systemEmailAddress', 'user'];
|
||||
} elseif ($name == 'systemEmailName' && $moduleId == 'mailing') {
|
||||
return ['mailer.systemEmailName', 'user'];
|
||||
} elseif ($name == 'systemEmailReplyTo' && $moduleId == 'mailing') {
|
||||
return ['mailer.systemEmailReplyTo', 'user'];
|
||||
} elseif ($name == 'enabled' && $moduleId == 'proxy') {
|
||||
return ['proxy.enabled', 'base'];
|
||||
} elseif ($name == 'server' && $moduleId == 'proxy') {
|
||||
|
@ -14,6 +14,7 @@ class MailingSettingsForm extends \yii\base\Model
|
||||
|
||||
public $systemEmailAddress;
|
||||
public $systemEmailName;
|
||||
public $systemEmailReplyTo;
|
||||
public $transportType;
|
||||
public $hostname;
|
||||
public $username;
|
||||
@ -41,6 +42,7 @@ class MailingSettingsForm extends \yii\base\Model
|
||||
$this->allowSelfSignedCerts = $settingsManager->get('mailer.allowSelfSignedCerts');
|
||||
$this->systemEmailAddress = $settingsManager->get('mailer.systemEmailAddress');
|
||||
$this->systemEmailName = $settingsManager->get('mailer.systemEmailName');
|
||||
$this->systemEmailReplyTo = $settingsManager->get('mailer.systemEmailReplyTo');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +57,7 @@ class MailingSettingsForm extends \yii\base\Model
|
||||
['allowSelfSignedCerts', 'boolean'],
|
||||
['systemEmailAddress', 'email'],
|
||||
['port', 'integer', 'min' => 1, 'max' => 65535],
|
||||
[['transportType', 'hostname', 'username', 'password', 'encryption', 'allowSelfSignedCerts', 'systemEmailAddress', 'systemEmailName'], 'string', 'max' => 255],
|
||||
[['transportType', 'hostname', 'username', 'password', 'encryption', 'allowSelfSignedCerts', 'systemEmailAddress', 'systemEmailName', 'systemEmailReplyTo'], 'string', 'max' => 255],
|
||||
];
|
||||
}
|
||||
|
||||
@ -67,6 +69,7 @@ class MailingSettingsForm extends \yii\base\Model
|
||||
return [
|
||||
'systemEmailAddress' => Yii::t('AdminModule.settings', 'E-Mail sender address'),
|
||||
'systemEmailName' => Yii::t('AdminModule.settings', 'E-Mail sender name'),
|
||||
'systemEmailReplyTo' => Yii::t('AdminModule.settings', 'E-Mail reply-to'),
|
||||
'transportType' => Yii::t('AdminModule.settings', 'Mail Transport Type'),
|
||||
'username' => Yii::t('AdminModule.settings', 'Username'),
|
||||
'password' => Yii::t('AdminModule.settings', 'Password'),
|
||||
@ -76,6 +79,16 @@ class MailingSettingsForm extends \yii\base\Model
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeHints()
|
||||
{
|
||||
return [
|
||||
'systemEmailReplyTo' => Yii::t('AdminModule.settings', 'Optional. Default reply address for system emails like notifications.'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the form
|
||||
*
|
||||
@ -95,6 +108,7 @@ class MailingSettingsForm extends \yii\base\Model
|
||||
$settingsManager->set('mailer.allowSelfSignedCerts', $this->allowSelfSignedCerts);
|
||||
$settingsManager->set('mailer.systemEmailAddress', $this->systemEmailAddress);
|
||||
$settingsManager->set('mailer.systemEmailName', $this->systemEmailName);
|
||||
$settingsManager->set('mailer.systemEmailReplyTo', $this->systemEmailReplyTo);
|
||||
|
||||
\humhub\libs\DynamicConfig::rewrite();
|
||||
|
||||
|
@ -18,6 +18,7 @@ use humhub\widgets\Button;
|
||||
|
||||
<?= $form->field($model, 'systemEmailAddress')->textInput(['readonly' => $settings->isFixed('mailer.systemEmailAddress')]); ?>
|
||||
<?= $form->field($model, 'systemEmailName')->textInput(['readonly' => $settings->isFixed('mailer.systemEmailName')]); ?>
|
||||
<?= $form->field($model, 'systemEmailReplyTo')->textInput(['readonly' => $settings->isFixed('mailer.systemEmailReplyTo')]); ?>
|
||||
<?= $form->field($model, 'transportType')->dropDownList($transportTypes, ['readonly' => $settings->isFixed('mailer.transportType')]); ?>
|
||||
|
||||
|
||||
|
@ -77,6 +77,9 @@ class MailTarget extends BaseTarget
|
||||
->setFrom([Yii::$app->settings->get('mailer.systemEmailAddress') => $from])
|
||||
->setTo($recipient->email)
|
||||
->setSubject(str_replace("\n", " ", trim($notification->getMailSubject())));
|
||||
if ($replyTo = Yii::$app->settings->get('mailer.systemEmailReplyTo')) {
|
||||
$mail->setReplyTo($replyTo);
|
||||
}
|
||||
|
||||
if ($notification->beforeMailSend($mail)) {
|
||||
$mail->send();
|
||||
|
Loading…
x
Reference in New Issue
Block a user