From 9c7b6966451e631bec5fc35f08958a8a83cf6094 Mon Sep 17 00:00:00 2001 From: root 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; }