View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004512 | mantisbt | public | 2004-09-08 15:07 | 2012-04-03 00:48 | |
Reporter | chipux | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | acknowledged | Resolution | open | ||
Summary | 0004512: Patch: Add X-Mantis-* Headers to E-Mail | ||||
Description | This patch adds X-Mantis-* Headers to E-Mails to make it easier to sort incoming emails with any mail client. | ||||
Tags | patch | ||||
Attached Files | add_email_headers.patch (1,823 bytes)
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 22 Mar 2007 17:15:44 -0000 @@ -843,6 +843,9 @@ $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( 'X-Mantis-Site' => config_get( 'path' ), 'X-Mantis-Action' => 'reminder', 'X-Mantis-Project' => $t_project_id, 'X-Mantis-Bugid' => $p_bug_id ); + $result = array(); foreach ( $p_recipients as $t_recipient ) { lang_push( user_pref_get_language( $t_recipient, $t_project_id ) ); @@ -862,7 +865,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 +910,12 @@ $t_message .= email_format_bug_message( $p_visible_bug_data ); + # @@@ Iwao AVE! : Create custom headers for bug info email. + $t_custom_header_list = array( 'keywords' => $p_visible_bug_data['set_category'], 'X-Mantis-Site' => config_get( 'path' ), 'X-Mantis-Action' => 'info', 'X-Mantis-Project' => $p_project_id, 'X-Mantis-Bugid' => $p_visible_bug_data['email_bug'] ); + # 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; } add_email_headers_20070323.patch (3,049 bytes)
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; } | ||||
chipux, thanks for the patch. Please check 0001569 to see if your patch covers points mentioned there. |
|
Uploaded a patch against revision 1.127 (1.1.0a3-CVS).
Note that I use project id instead of project name because I don't like multi byte characters to be in header. But it won't be difficult to change this behavior. It would be better to merge this with issue:7787. |
|
Thanks for your contribution. Following are my comments:
My recommendation is to drop 4 and 5 for now. Maybe one day we should introduce project short name like the unix name for projects hosted on sourceforge. This can then be added in the headers. |
|
Thanks for following up.
The project short name sounds better than id. |
|
Is there any chance that this patch will come to any release? |
|