Index: core/email_api.php
===================================================================
RCS file: /cvsroot/mantisbt/mantisbt/core/email_api.php,v
retrieving revision 1.127
diff -u -r1.127 email_api.php
--- core/email_api.php	6 Mar 2007 05:51:22 -0000	1.127
+++ core/email_api.php	23 Mar 2007 14:27:35 -0000
@@ -839,10 +839,23 @@
 		$t_project_id = bug_get_field( $p_bug_id, 'project_id' );
 		$t_sender_id = auth_get_current_user_id();
 		$t_sender = user_get_name( $t_sender_id );
+		$t_reporter = user_get_field( bug_get_field( $p_bug_id, 'reporter_id' ), 'username' );
+		$t_handler_id = bug_get_field( $p_bug_id, 'handler_id' );
+		if ( $t_handler_id != 0 ) {
+			$t_handler = user_get_field( $t_handler_id, 'username' );
+		} else {
+			$t_handler = '';
+		}
 
 		$t_subject = email_build_subject( $p_bug_id );
 		$t_date = date( config_get( 'normal_date_format' ) );
-		
+
+		# @@@ Iwao AVE! : Create custom headers for reminder email.
+		$t_custom_header_list = array();
+		$t_custom_header_list['X-Mantis-Site'] = config_get( 'path' );
+		$t_custom_header_list['X-Mantis-Type'] = 'reminder';
+		$t_custom_header_list['X-Mantis-Reporter'] = $t_reporter;
+
 		$result = array();
 		foreach ( $p_recipients as $t_recipient ) {
 			lang_push( user_pref_get_language( $t_recipient, $t_project_id ) );
@@ -855,6 +868,12 @@
 			} else {
 				$t_sender_email = '';
 			}
+			# @@@ Iwao AVE! : Check if handler exists and the recipient can see his/her name.
+			if ( $t_handler_id != 0 && access_has_project_level( config_get( 'view_handler_threshold' ), $t_project_id, $t_recipient ) ) {
+				$t_custom_header_list['X-Mantis-Owner'] = $t_handler;
+			} else {
+				$t_custom_header_list['X-Mantis-Owner'] = '';
+			}
 			$t_header = "\n" . lang_get( 'on' ) . " $t_date, $t_sender $t_sender_email " .
 						lang_get( 'sent_you_this_reminder_about' ) . ": \n\n";
 			$t_contents = $t_header .
@@ -862,7 +881,7 @@
 							" \n\n$p_message";
 
 			if( ON == config_get( 'enable_email_notification' ) ) {
-				email_store( $t_email, $t_subject, $t_contents );
+				email_store( $t_email, $t_subject, $t_contents, $t_custom_header_list );
 			}
 
 			lang_pop();
@@ -907,9 +926,17 @@
 
 		$t_message .= email_format_bug_message(  $p_visible_bug_data );
 
+		# @@@ Iwao AVE! : Create custom headers for bug info email.
+		$t_custom_header_list = array();
+		$t_custom_header_list['keywords'] = $p_visible_bug_data['set_category'];
+		$t_custom_header_list['X-Mantis-Site'] = config_get( 'path' );
+		$t_custom_header_list['X-Mantis-Type'] = 'notification';
+		$t_custom_header_list['X-Mantis-Reporter'] = $p_visible_bug_data['email_reporter'];
+		$t_custom_header_list['X-Mantis-Owner'] = $p_visible_bug_data['email_handler'];
+
 		# send mail
 		# PRINT '<br />email_bug_info::Sending email to :'.$t_user_email;
-		$t_ok = email_store( $t_user_email, $t_subject, $t_message, array( 'keywords' => $p_visible_bug_data['set_category'] ) );
+		$t_ok = email_store( $t_user_email, $t_subject, $t_message, $t_custom_header_list );
 
 		return $t_ok;
 	}
