diff --git a/lam/docs/manual-sources/howto.xml b/lam/docs/manual-sources/howto.xml
index 8a23fba0..92261b2a 100644
--- a/lam/docs/manual-sources/howto.xml
+++ b/lam/docs/manual-sources/howto.xml
@@ -2074,6 +2074,18 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
Optional Reply-to address for email.
+
+ CC address
+
+ Optional CC mail address.
+
+
+
+ BCC address
+
+ Optional BCC mail address.
+
+
Subject
@@ -2170,6 +2182,18 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
Optional Reply-to address for email.
+
+ CC address
+
+ Optional CC mail address.
+
+
+
+ BCC address
+
+ Optional BCC mail address.
+
+
Subject
@@ -2250,6 +2274,18 @@ mysql> GRANT ALL PRIVILEGES ON lam_cron.* TO 'lam_cron'@'localhost';
Optional Reply-to address for email.
+
+ CC address
+
+ Optional CC mail address.
+
+
+
+ BCC address
+
+ Optional BCC mail address.
+
+
Subject
diff --git a/lam/docs/manual-sources/images/jobs_ppolicy1.png b/lam/docs/manual-sources/images/jobs_ppolicy1.png
index 08c6c212..4e97f278 100644
Binary files a/lam/docs/manual-sources/images/jobs_ppolicy1.png and b/lam/docs/manual-sources/images/jobs_ppolicy1.png differ
diff --git a/lam/docs/manual-sources/images/jobs_shadow1.png b/lam/docs/manual-sources/images/jobs_shadow1.png
index f7d4544e..d9253866 100644
Binary files a/lam/docs/manual-sources/images/jobs_shadow1.png and b/lam/docs/manual-sources/images/jobs_shadow1.png differ
diff --git a/lam/docs/manual-sources/images/jobs_windows1.png b/lam/docs/manual-sources/images/jobs_windows1.png
index d108c3b7..cbf607f7 100644
Binary files a/lam/docs/manual-sources/images/jobs_windows1.png and b/lam/docs/manual-sources/images/jobs_windows1.png differ
diff --git a/lam/help/help.inc b/lam/help/help.inc
index 122b96c0..dee0e630 100644
--- a/lam/help/help.inc
+++ b/lam/help/help.inc
@@ -325,6 +325,14 @@ $helpArray = array (
"Headline" => _('Notification period'),
"Text" => _('Please enter the number of days before password expiration to send out the email.')
),
+ '805' => array(
+ "Headline" => _('CC address'),
+ "Text" => _('This email address will be set as CC address of all mails.')
+ ),
+ '806' => array(
+ "Headline" => _('BCC address'),
+ "Text" => _('This email address will be set as BCC address of all mails.')
+ ),
);
/* This is a sample help entry. Just copy this line an modify the values between the [] brackets.
diff --git a/lam/lib/account.inc b/lam/lib/account.inc
index d94ab068..fcfe40f4 100644
--- a/lam/lib/account.inc
+++ b/lam/lib/account.inc
@@ -1093,21 +1093,23 @@ function sendPasswordMail($pwd, $user, $recipient = null) {
* @param String $from FROM address
* @param boolean $isHTML mail is formatted as HTML or plain text
* @param String $replyTo reply-to address (optional)
+ * @param String $cc CC address
+ * @param String $bcc BCC address
* @return String header lines
*/
-function createEMailHeaders($from, $isHTML, $replyTo = null) {
+function createEMailHeaders($from, $isHTML, $replyTo = null, $cc = null, $bcc = null) {
$headerLines = "X-Mailer: LDAP Account Manager\r\n";
if (!empty($from)) {
- if (preg_match('/^(.*)<(.*)>$/', $from, $matchesFrom)) {
- $from = base64EncodeForEMail($matchesFrom[1]) . ' <' . $matchesFrom[2] . '>';
- }
- $headerLines .= 'From: ' . $from . "\r\n";
+ $headerLines .= 'From: ' . encodeMailAddress($from) . "\r\n";
}
if (!empty($replyTo)) {
- if (preg_match('/^(.*)<(.*)>$/', $replyTo, $matchesReplyTo)) {
- $replyTo = base64EncodeForEMail($matchesReplyTo[1]) . ' <' . $matchesReplyTo[2] . '>';
- }
- $headerLines .= 'Reply-To: ' . $replyTo . "\r\n";
+ $headerLines .= 'Reply-To: ' . encodeMailAddress($replyTo) . "\r\n";
+ }
+ if (!empty($cc)) {
+ $headerLines .= 'Cc: ' . encodeMailAddress($cc) . "\r\n";
+ }
+ if (!empty($bcc)) {
+ $headerLines .= 'Bcc: ' . encodeMailAddress($bcc) . "\r\n";
}
$headerLines .= "MIME-Version: 1.0\r\n";
if ($isHTML) {
@@ -1119,6 +1121,21 @@ function createEMailHeaders($from, $isHTML, $replyTo = null) {
return $headerLines;
}
+/**
+ * Encodes the email address for the header part of an email.
+ *
+ * @param String $address email address
+ * @return String encoded mail address
+ */
+function encodeMailAddress($address) {
+ $matches = array();
+ // if the email contains a name part then base64 encode it
+ if (preg_match('/^(.*)<(.*)>$/', $address, $matches)) {
+ return base64EncodeForEMail($matches[1]) . ' <' . $matches[2] . '>';
+ }
+ return $address;
+}
+
/**
* Returns a base64 encoded string of the given values in a fomat that is used in emails.
*