From 29ec10305cab29480736cb68020f6a5cfeaf9fc5 Mon Sep 17 00:00:00 2001 From: Gianluca Sforna Date: Fri, 8 Feb 2008 23:57:40 +0000 Subject: [PATCH] Fix 8706: Bad email headers for notifications git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4974 f5dc347c-c33d-0410-90a0-b07cc1902cb9 --- core/email_api.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/core/email_api.php b/core/email_api.php index 85c6edcde9..93202f7086 100644 --- a/core/email_api.php +++ b/core/email_api.php @@ -497,6 +497,7 @@ function email_generic( $p_bug_id, $p_notify_type, $p_message_id = null, $p_head # send email to every recipient foreach ( $t_recipients as $t_user_id => $t_user_email ) { + echo "email sent to $t_user_email
"; # load (push) user language here as build_visible_bug_data assumes current language lang_push( user_pref_get_language( $t_user_id, $t_project_id ) ); @@ -794,7 +795,18 @@ function email_send( $p_email_data ) { if ( isset( $t_email_data->metadata['headers'] ) && is_array( $t_email_data->metadata['headers'] ) ) { foreach ( $t_email_data->metadata['headers'] as $t_key => $t_value ) { - $mail->AddCustomHeader( "$t_key: $t_value" ); + switch ( $t_key ) { + case 'Message-ID': + // Overwrite default Message ID + $mail->set( 'MessageID', $t_value ); + break; + case 'In-Reply-To': + $mail->AddCustomHeader( "$t_key: <{$t_value}@{$mail->Hostname}>" ); + break; + default: + $mail->AddCustomHeader( "$t_key: $t_value" ); + break; + } } } @@ -952,9 +964,9 @@ function email_bug_info_to_one_user( $p_visible_bug_data, $p_message_id, $p_proj $t_message_md5 = md5( $t_bug_id . $p_visible_bug_data['email_date_submitted'] ); $t_mail_headers = array( 'keywords' => $p_visible_bug_data['set_category'] ); if ( $p_message_id == 'email_notification_title_for_action_bug_submitted' ) { - $t_mail_headers['Message-ID'] = "<{$t_message_md5}>"; + $t_mail_headers['Message-ID'] = $t_message_md5; } else { - $t_mail_headers['In-Reply-To'] = "<{$t_message_md5}>"; + $t_mail_headers['In-Reply-To'] = $t_message_md5; } # send mail