View Issue Details

IDProjectCategoryView StatusLast Update
0003398mantisbtemailpublic2014-11-07 15:06
Reporterjohnwebbcole Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Summary0003398: Include options for what is sent in an email
Description

It would be nice to be able to have a few options on what is included in emails.

For example:
Option to include bug history (similar to one for viewing a bug)
Option to include all bugnotes or last X number of bugnotes.
Option to reverse the order the bugnotes are listed in, so that the most recent is at the top (would be really usefull in conjunction with the above option)
Option to include user defined, or project defined text in email, such as contact info or special instructions on how to handle a bug.

Tagspatch
Attached Files
configurable_email.patch (3,315 bytes)   
Index: config_defaults_inc.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/config_defaults_inc.php,v
retrieving revision 1.130
diff -u -r1.130 config_defaults_inc.php
--- config_defaults_inc.php	1 Sep 2003 14:06:57 -0000	1.130
+++ config_defaults_inc.php	19 Nov 2003 22:10:17 -0000
@@ -186,6 +186,21 @@
 	# Whether user's should receive emails for their own actions
 	$g_email_receive_own	= OFF;
 	
+        # Include bug history in bug info email
+        $g_email_include_history        = ON;
+        
+        # Leave blank for default
+        # use DESC for decending order by timestamp
+        $g_email_bugnote_order  = '';
+        
+        # limit the number of bugnotes in an email
+        # note:  this only makes sense if the
+        # email_bugnote_order is 'DESC' 
+        # otherwise only the first few bugnotes
+        # will be shown instead of the last few
+        # 0 will return all bugnotes
+        $g_email_bugnote_limit  = 0;
+        
 	# set to OFF to disable email check
 	$g_validate_email		= ON;
 	$g_check_mx_record		= ON;
Index: core/email_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v
retrieving revision 1.63
diff -u -r1.63 email_api.php
--- core/email_api.php	31 Aug 2003 11:32:20 -0000	1.63
+++ core/email_api.php	19 Nov 2003 22:10:18 -0000
@@ -473,7 +473,8 @@
 	function email_build_bugnote_message( $p_bug_id ) {
 		global 	$g_mantis_bugnote_table, $g_mantis_bugnote_text_table,
 				$g_complete_date_format,
-				$g_bugnote_order, $g_email_separator2;
+				$g_email_bugnote_order, $g_email_separator2,
+                                $g_email_bugnote_limit;
 
 		$c_bug_id = (integer)$p_bug_id;
 
@@ -484,7 +485,12 @@
 		$query = "SELECT *, UNIX_TIMESTAMP(last_modified) as last_modified
 				FROM $g_mantis_bugnote_table
 				WHERE bug_id='$c_bug_id' AND view_state='$t_state'
-				ORDER BY date_submitted $g_bugnote_order";
+				ORDER BY date_submitted $g_email_bugnote_order";
+                
+                if ( $g_email_bugnote_limit > 0 ) {
+                        $query .= " LIMIT 0, $g_email_bugnote_limit";
+                }
+                                
 		$result = db_query( $query );
 		$bugnote_count = db_num_rows( $result );
 
@@ -543,7 +549,9 @@
 		$t_message = $p_message."\n";
 		$t_message .= email_build_bug_message( $p_bug_id, $p_message, $t_category );
 		$t_message .= email_build_bugnote_message( $p_bug_id );
-		$t_message .= email_build_history_message( $p_bug_id );
+                if ( ON == config_get( 'email_include_history' ) ) {
+                    $t_message .= email_build_history_message( $p_bug_id );
+                }
 
 		# send mail
 
@@ -603,7 +611,8 @@
 
 			# Support PHPMailer v1.7x
 			if ( method_exists( $mail, 'SetLanguage' ) ) {
-				$mail->SetLanguage( lang_get( 'phpmailer_language' ), $t_phpMailer_path . 'language' . DIRECTORY_SEPARATOR );
+			# JwC - this doesn't seem to work with 1.7x 
+                        #	$mail->SetLanguage( lang_get( 'phpmailer_language' ), $t_phpMailer_path . 'language' . DIRECTORY_SEPARATOR );
 			}
 
 			# Select the method to send mail
configurable_email.patch (3,315 bytes)   

Relationships

has duplicate 0003263 closedgrangeway E-Mail notification should include version 

Activities

johnwebbcole

johnwebbcole

2003-11-19 23:15

reporter   ~0004747

I've added a patch from the current CVS version to add a few global parameters for controling email format.

g_email_include_history to turn on/off the history at the bottom of an email (if you want it off in the main view, its nice not to see it in the email as well).

g_email_bugnote_order just to separate the order in the email from the order in the main view bug

g_email_bugnote_limit to limit the number of bugnotes included in the email. This really only makes sense if your g_email_bugnote_order is 'DESC' and you only want to see the last 5 bugnotes.

johnwebbcole

johnwebbcole

2003-11-19 23:16

reporter   ~0004748

One other thing in the patch file that some may not want is the phpmailer 1.7x fix that doesn not seem to work on my win32 phpmailer 1.71 version. I commented out a line and that seems to fix it. Milage my vary for others.

vboctor

vboctor

2009-09-05 01:45

manager   ~0022885

Thanks @johnwebbcole for your contribution. Here are a couple of comments:

  1. Given that we are not using parameterized queries in this situation, I would rather if we db prepare the variables before inserting them in the query.

  2. It would be great if you can update the configuration section in the Docbook manual to include the documentation for the new configuration options.