diff --git a/lam/help/help.inc b/lam/help/help.inc index c69e4cfb..351c4e7b 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -194,6 +194,8 @@ $helpArray = array ( '
  • ' . _('The wildcard for the new password is @@newPassword@@.') . '
  • '), "553" => array ("Headline" => _("HTML format"), "Text" => _('Specifies if the mail should be sent as text or HTML.')), + "554" => array ("Headline" => _("Reply-to address"), + "Text" => _("This email address will be set as reply-to address of all password mails.")), // 600 - 699 // OU-editor, domain page "601" => array ("Headline" => _("OU-Editor") . " - " . _("New organisational unit"), diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 9a0d1225..af116af6 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -257,6 +257,9 @@ class LAMConfig { /** email address for sender of password reset mails */ private $lamProMailFrom = ''; + /** reply-to email address for password reset mails */ + private $lamProMailReplyTo = ''; + /** subject for password reset mails */ private $lamProMailSubject = ''; @@ -270,7 +273,7 @@ class LAMConfig { private $settings = array("ServerURL", "useTLS", "Passwd", "Admins", "treesuffix", "defaultLanguage", "scriptPath", "scriptServer", "scriptRights", "cachetimeout", "modules", "activeTypes", "types", "accessLevel", 'loginMethod', 'loginSearchSuffix', - 'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailSubject', + 'loginSearchFilter', 'searchLimit', 'lamProMailFrom', 'lamProMailReplyTo', 'lamProMailSubject', 'lamProMailText', 'lamProMailIsHTML'); @@ -423,6 +426,7 @@ class LAMConfig { if (!in_array("loginSearchSuffix", $saved)) array_push($file_array, "\n\n# Search suffix for LAM login.\n" . "loginSearchSuffix: " . $this->loginSearchSuffix . "\n"); if (!in_array("loginSearchFilter", $saved)) array_push($file_array, "\n\n# Search filter for LAM login.\n" . "loginSearchFilter: " . $this->loginSearchFilter . "\n"); if (!in_array("lamProMailFrom", $saved)) array_push($file_array, "\n\n# Password mail from\n" . "lamProMailFrom: " . $this->lamProMailFrom . "\n"); + if (!in_array("lamProMailReplyTo", $saved)) array_push($file_array, "\n\n# Password mail reply-to\n" . "lamProMailReplyTo: " . $this->lamProMailReplyTo . "\n"); if (!in_array("lamProMailSubject", $saved)) array_push($file_array, "\n\n# Password mail subject\n" . "lamProMailSubject: " . $this->lamProMailSubject . "\n"); if (!in_array("lamProMailIsHTML", $saved)) array_push($file_array, "\n\n# Password mail is HTML\n" . "lamProMailIsHTML: " . $this->lamProMailIsHTML . "\n"); if (!in_array("lamProMailText", $saved)) array_push($file_array, "\n\n# Password mail text\n" . "lamProMailText: " . $this->lamProMailText . "\n"); @@ -1059,6 +1063,29 @@ class LAMConfig { return true; } + /** + * Returns the reply-to address for password reset mails. + * + * @return String mail address + */ + public function getLamProMailReplyTo() { + return $this->lamProMailReplyTo; + } + + /** + * Sets the reply-to address for password reset mails. + * + * @param String $lamProMailReplyTo mail address + * @return boolean true if address is valid + */ + public function setLamProMailReplyTo($lamProMailReplyTo) { + $this->lamProMailReplyTo = $lamProMailReplyTo; + if (($lamProMailReplyTo != '') && !get_preg($lamProMailReplyTo, 'email') && !get_preg($lamProMailReplyTo, 'emailWithName')) { + return false; + } + return true; + } + /** * Returns the subject for password reset mails. * diff --git a/lam/templates/config/confmain.php b/lam/templates/config/confmain.php index 85e6b402..0cd811da 100644 --- a/lam/templates/config/confmain.php +++ b/lam/templates/config/confmain.php @@ -314,6 +314,9 @@ if (isLAMProVersion()) { $pwdMailFrom = new htmlTableExtendedInputField(_('From address'), 'pwdResetMail_from', $conf->getLamProMailFrom(), '550'); $pwdMailContent->addElement($pwdMailFrom, true); + $pwdMailReplyTo = new htmlTableExtendedInputField(_('Reply-to address'), 'pwdResetMail_replyTo', $conf->getLamProMailReplyTo(), '554'); + $pwdMailContent->addElement($pwdMailReplyTo, true); + $pwdMailSubject = new htmlTableExtendedInputField(_('Subject'), 'pwdResetMail_subject', $conf->getLamProMailSubject(), '551'); $pwdMailContent->addElement($pwdMailSubject, true); @@ -418,6 +421,9 @@ function checkInput() { if (!$conf->setLamProMailFrom($_POST['pwdResetMail_from'])) { $errors[] = array("ERROR", _("From address for password mails is invalid."), $_POST['pwdResetMail_from']); } + if (!$conf->setLamProMailReplyTo($_POST['pwdResetMail_replyTo'])) { + $errors[] = array("ERROR", _("Reply-to address for password mails is invalid."), $_POST['pwdResetMail_replyTo']); + } $conf->setLamProMailSubject($_POST['pwdResetMail_subject']); if (isset($_POST['pwdResetMail_isHTML']) && ($_POST['pwdResetMail_isHTML'] == 'on')) { $conf->setLamProMailIsHTML('true');