View Issue Details

IDProjectCategoryView StatusLast Update
0015593mantisbtemailpublic2020-04-14 11:19
ReporterHeikoSL Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status acknowledgedResolutionopen 
Product Version1.2.14 
Summary0015593: Add a globalwatcher email config option, all emails are copied to
Description

My employer eCola GmbH wanted to get all emails mantis has send as a copy in a specified email account.

I added a config option $g_globalwatcher_email to config_defaults_inc.php that can hold the email address or switched OFF.

Depending on the config option every email that will be stored in the queue is added a second time to the queue but with the $g_globalwatcher_email-address. (functionality added to email_api.php, function email_store)

Additional Information

patch file in attach

Tagspatch
Attached Files
Glob_watch.patch (1,780 bytes)   
From 9c7b6966451e631bec5fc35f08958a8a83cf6094 Mon Sep 17 00:00:00 2001
From: root <root@bugtracker.local>
Date: Tue, 12 Mar 2013 15:34:18 +0100
Subject: [PATCH] Added globalwatcher email functionality

---
 config_defaults_inc.php  |    8 +
 core/email_api.php       |   16 +-
 ]2 files changed, 24 insertions(+), 1 deletions(-)
 

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 01f649c..14623fa 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -344,6 +344,14 @@
 	$g_return_path_email	= 'admin@example.com';
 
 	/**
+	 * the globalwatcher adress, every email is sent to as Bcc
+	 * default is OFF
+	 * set to an email address to use
+	 * @global string|int $g_globalwatcher_email
+	 */
+	$g_globalwatcher_email	= OFF;
+	 
diff --git a/core/email_api.php b/core/email_api.php
index 4feb496..92d23f3 100644
--- a/core/email_api.php
+++ b/core/email_api.php
@@ -830,7 +830,21 @@ function email_store( $p_recipient, $p_subject, $p_message, $p_headers = null )
 	$t_email_data->metadata['hostname'] = $t_hostname;
 
 	$t_email_id = email_queue_add( $t_email_data );
-
+	
+	# add globalwatcher emails
+	$t_globalwatcher_recipient = config_get( 'globalwatcher_email' );
+	if($t_globalwatcher_recipient !== OFF) {
+		$t_globalwatcher_message = 'This e-mail was originally sent to '.$t_recipient.' .';
+		$t_globalwatcher_message.= " \n\n".$t_message;
+		
+		$t_email_data->email = $t_globalwatcher_recipient;
+		$t_email_data->body = $t_globalwatcher_message;
+		
+		$t_globalwatcher_email_id = email_queue_add( $t_email_data );
+		log_event( LOG_EMAIL, 'Globalwatcher e-mail #'.$t_globalwatcher_email_id.' attached to queue for e-mail #'.$t_email_id );
+	}
+	
+	
 	return $t_email_id;
 }
 
Glob_watch.patch (1,780 bytes)   

Activities

atrol

atrol

2013-03-12 15:40

developer   ~0035441

Thank you for this contribution.
Would be fine if you could attach a patch which contains just the needed changes but not additional files like config_defaults_inc.php~ and email_api.php~

cas

cas

2013-03-13 00:01

reporter   ~0035445

Nice addon.
Cleaned the patch file so it only contains what is actually needed

HeikoSL

HeikoSL

2013-03-13 05:03

reporter   ~0035450

Thank you cas. Next time I hopefully will clean it on my own...