central mail sending
This commit is contained in:
parent
280e9a290d
commit
7c377bbcd2
|
@ -1030,6 +1030,28 @@ Have fun!
|
|||
</screenshot>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Additional options</title>
|
||||
|
||||
<para id="mailEOL"><emphasis role="bold">Email
|
||||
format</emphasis></para>
|
||||
|
||||
<para>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".</para>
|
||||
|
||||
<para>At the moment, this option is only available in LAM Pro as there
|
||||
is no mail sending in the free version.</para>
|
||||
|
||||
<screenshot>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="images/configGeneral6.png" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</screenshot>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Change master password</title>
|
||||
|
||||
|
@ -5255,7 +5277,9 @@ Run slapindex to rebuild the index.
|
|||
<para>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.</para>
|
||||
to setup the sender address, subject and mail body. Please see <link
|
||||
linkend="mailEOL">email format option</link> in case of broken
|
||||
mails.</para>
|
||||
|
||||
<para>Using this method will prevent that your support staff knows
|
||||
the new password.</para>
|
||||
|
@ -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.</para>
|
||||
attributes. E.g. "@@uid@@" will be replaced by the user name. Please
|
||||
see <link linkend="mailEOL">email format option</link> in case of
|
||||
broken mails.</para>
|
||||
|
||||
<literallayout> </literallayout>
|
||||
|
||||
|
@ -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: <emphasis>uid=<user name>,...</emphasis></para>
|
||||
|
||||
<para>Please see <link linkend="mailEOL">email format
|
||||
option</link> in case of broken mails.</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -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"),
|
||||
|
|
|
@ -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).
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue