diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml index 1473e873..526bbc40 100644 --- a/lam/docs/manual-sources/howto.xml +++ b/lam/docs/manual-sources/howto.xml @@ -1030,6 +1030,28 @@ Have fun! +
+ Additional options + + Email + format + + Some email servers are not standards compatible. If you receive + mails that look broken you can change the line endings for sent mails + here. Default is to use "\r\n". + + At the moment, this option is only available in LAM Pro as there + is no mail sending in the free version. + + + + + + + + +
+
Change master password @@ -5255,7 +5277,9 @@ Run slapindex to rebuild the index. If the user account has set the mail attribute then LAM can send your user a mail with the new password. You can change the mail template to fit your needs. Please configure your LAM server profile - to setup the sender address, subject and mail body. + to setup the sender address, subject and mail body. Please see email format option in case of broken + mails. Using this method will prevent that your support staff knows the new password. @@ -6083,7 +6107,9 @@ Run slapindex to rebuild the index. change. The mail can include the new password by using the special wildcard "@@newPassword@@". Additionally, you may want to insert other wildcards that are replaced by the corresponding LDAP - attributes. E.g. "@@uid@@" will be replaced by the user name. + attributes. E.g. "@@uid@@" will be replaced by the user name. Please + see email format option in case of + broken mails. @@ -6292,6 +6318,9 @@ Run slapindex to rebuild the index. valid for 24 hours. When he clicks on this link then the account will be created in the self service user suffix. The DN will look like this: uid=<user name>,... + + Please see email format + option in case of broken mails.
diff --git a/lam/docs/manual-sources/images/configGeneral6.png b/lam/docs/manual-sources/images/configGeneral6.png new file mode 100644 index 00000000..65cc8b81 Binary files /dev/null and b/lam/docs/manual-sources/images/configGeneral6.png differ diff --git a/lam/help/help.inc b/lam/help/help.inc index 8f265b99..5b6ecab6 100644 --- a/lam/help/help.inc +++ b/lam/help/help.inc @@ -149,6 +149,8 @@ $helpArray = array ( "Text" => _("This is a list of IP addresses from hosts who may access LAM. You can use \"*\" as wildcard (e.g. 192.168.0.*).")), "242" => array ("Headline" => _("Password policy"), "Text" => _("Here you can specify minimum requirements for passwords. The character classes are: lowercase, uppercase, numeric and symbols.")), + "243" => array ("Headline" => _('Email format'), + "Text" => _('Please change this setting only if you experience problems in receiving emails from LAM. This defines the line ending of emails.')), "250" => array ("Headline" => _("Filter"), "Text" => _("Here you can input simple filter expressions (e.g. 'value' or 'v*'). The filter is case-sensitive.")), "260" => array ("Headline" => _("Additional LDAP filter"), diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 1773b120..3300db14 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -989,7 +989,7 @@ function sendPasswordMail($pwd, $user, $recipient = null) { $found = preg_match('/\@\@[^\@]+\@\@/', $body, $results); } $headerLines = createEMailHeaders($mailFrom, ($mailIsHTML == 'true'), $mailReplyTo); - $success = mail($mailTo, base64EncodeForEMail($subject), $body, $headerLines); + $success = sendEMail($mailTo, $subject, $body, $headerLines); if ($success) { logNewMessage(LOG_DEBUG, 'Sent password mail to ' . $mailTo); return array( @@ -1045,6 +1045,23 @@ function base64EncodeForEMail($value) { return '=?UTF-8?B?' . base64_encode($value) . '?='; } +/** + * Sends out an email. + * + * @param String $to TO address + * @param String $subject email subject + * @param String $text mail body (with \r\n EOL) + * @param String $headers header lines (with \r\n EOL) + */ +function sendEMail($to, $subject, $text, $headers) { + if (!empty($_SESSION['cfgMain']->mailEOL) && ($_SESSION['cfgMain']->mailEOL === 'unix')) { + $text = str_replace("\r\n", "\n", $text); + $headers = str_replace("\r\n", "\n", $headers); + } + logNewMessage(LOG_WARNING, $text); + return mail($to, base64EncodeForEMail($subject), $text, $headers); +} + /** * Caches module objects. * This improves performance if the same module does not need to be created multiple times (calling get_metaData() each time). diff --git a/lam/lib/config.inc b/lam/lib/config.inc index cba2e190..287a797f 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -1396,12 +1396,15 @@ class LAMCfgMain { /** SSL certificate should be deleted on save() */ private $delSSLCaCert = false; + + /** EOL for emails (default/unix) */ + public $mailEOL = 'default'; /** list of data fields to save in config file */ private $settings = array("password", "default", "sessionTimeout", "logLevel", "logDestination", "allowedHosts", "passwordMinLength", "passwordMinUpper", "passwordMinLower", "passwordMinNumeric", - "passwordMinClasses", "passwordMinSymbol"); + "passwordMinClasses", "passwordMinSymbol", "mailEOL"); /** * Loads preferences from config file @@ -1486,6 +1489,7 @@ class LAMCfgMain { if (!in_array("passwordMinNumeric", $saved)) array_push($file_array, "\n\n# Password: minimum numeric characters\n" . "passwordMinNumeric: " . $this->passwordMinNumeric); if (!in_array("passwordMinSymbol", $saved)) array_push($file_array, "\n\n# Password: minimum symbolic characters\n" . "passwordMinSymbol: " . $this->passwordMinSymbol); if (!in_array("passwordMinClasses", $saved)) array_push($file_array, "\n\n# Password: minimum character classes (0-4)\n" . "passwordMinClasses: " . $this->passwordMinClasses); + if (!in_array("mailEOL", $saved)) array_push($file_array, "\n\n# Email format (default/unix)\n" . "mailEOL: " . $this->mailEOL); $file = @fopen($this->conffile, "w"); if ($file) { for ($i = 0; $i < sizeof($file_array); $i++) fputs($file, $file_array[$i]); @@ -1759,7 +1763,7 @@ class LAMCfgMain { } return $list; } - + } ?> diff --git a/lam/templates/config/mainmanage.php b/lam/templates/config/mainmanage.php index 41938e5b..f14dfe7d 100644 --- a/lam/templates/config/mainmanage.php +++ b/lam/templates/config/mainmanage.php @@ -170,6 +170,10 @@ if (isset($_POST['submitFormData'])) { $cfg->deleteSSLCaCert($index); } } + // mail EOL + if (isLAMProVersion()) { + $cfg->mailEOL = $_POST['mailEOL']; + } // save settings if (isset($_POST['submit'])) { $cfg->save(); @@ -370,6 +374,21 @@ $loggingTable->addElement(new htmlInputField('logFile', $destinationPath), true) $container->addElement($loggingTable, true); $container->addElement(new htmlSpacer(null, '10px'), true); +// additional options +if (isLAMProVersion()) { + $container->addElement(new htmlSubTitle(_('Additional options')), true); + $additionalTable = new htmlTable(); + $mailEOLOptions = array( + _('Default (\r\n)') => 'default', + _('Non-standard (\n)') => 'unix' + ); + $mailEOLSelect = new htmlTableExtendedSelect('mailEOL', $mailEOLOptions, array($cfg->mailEOL), _('Email format'), '243'); + $mailEOLSelect->setHasDescriptiveElements(true); + $additionalTable->addElement($mailEOLSelect, true); + $container->addElement($additionalTable, true); + $container->addElement(new htmlSpacer(null, '10px'), true); +} + // change master password $container->addElement(new htmlSubTitle(_("Change master password")), true); $passwordTable = new htmlTable();