View Issue Details

IDProjectCategoryView StatusLast Update
0009753mantisbtemailpublic2009-06-26 12:05
Reporterquel Assigned Togiallu  
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
Platformx86 (intel processor, 32bit)OSDebian GNU/LinuxOS Version4.0 2.6.18-686
Product Version1.1.4 
Summary0009753: second Message-Id fails to contain hostname
Description

I upgraded from 1.0.8 to 1.1.4 and some email notifications from Mantis are rejected by the mail server:
" SMTP error from remote mail server after end of data:
host host.domain.com [xxx.xxx.x.xxx]: 553 5.0.0 Header Error"

Checking logs I saw:
Oct 27 13:19:30 webmail sm-mta[10513]: m9RIJTEI010513: ruleset=CheckMessageId, arg1=<d2f67d47b46c4cd102c7dfbadf464c8e>, relay=otherhost.domain.com [xxx.xxx.x.xxx], reject=553 5.0.0 Header Error

It seems to be that the 2nd Message-Id needs to have @hostname.com.

This was fixed in:
core/phpmailer/class.phpmailer.php:798
and noted on
doc/ChangeLog:338:- 0007521: [email] wrong Message-ID when "Mail Queuing" is used. (vboctor)

However, it appears to be broken at:
core/email_api.php:951: $t_mail_headers['Message-ID'] = "<{$t_message_md5}>";

The error seems to only appear on newly submitted issues.

Tagspatch
Attached Files
9753.patch (572 bytes)   
diff --git a/core/email_api.php b/core/email_api.php
index 1f2c496..7e02f93 100644
--- a/core/email_api.php
+++ b/core/email_api.php
@@ -801,9 +801,8 @@ function email_send( $p_email_data ) {
 		foreach( $t_email_data->metadata['headers'] as $t_key => $t_value ) {
 			switch( $t_key ) {
 				case 'Message-ID':
-
 					// Overwrite default Message ID
-					$mail->set( 'MessageID', $t_value );
+					$mail->set( 'MessageID', "<$t_value@{$mail->Hostname}>" );
 					break;
 				case 'In-Reply-To':
 					$mail->AddCustomHeader( "$t_key: <{$t_value}@{$mail->Hostname}>" );
9753.patch (572 bytes)   

Relationships

related to 0007521 closedvboctor wrong Message-ID when "Mail Queuing" is used. 

Activities

quel

quel

2008-10-29 13:23

reporter   ~0019728

quick and dirty patch (disclaimer: I haven't read any code/style guidelines so it may not conform to such)

--- bak_mantis-1.1.4/core/email_api.php 2008-05-30 15:53:29.000000000 -0500
+++ mantis-1.1.4/core/email_api.php 2008-10-29 12:20:30.000000000 -0500
@@ -948,7 +948,12 @@
$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_server = isset( $_SERVER ) ? $_SERVER : $HTTP_SERVER_VARS;
  • $t_serverHostname = $t_server["SERVER_NAME"];
  • $t_message_id = sprintf("%s@%s",$t_message_md5,$t_serverHostname);
  • $t_mail_headers['Message-ID'] = "<{$t_message_id}>";
    } else {
    $t_mail_headers['In-Reply-To'] = "<{$t_message_md5}>";
    }
vboctor

vboctor

2008-11-14 01:29

manager   ~0019879

I've done some testing and code inspection on 1.1.x and 1.2.x, in both cases the message ids are stamped correctly. Basically in case of the submission notification MantisBT sets the message id and host name in PHPMailer which then combines them into the appropriate format. In case of other notifications, MantisBT sets the In-Reply-To header with the full decorated message id + hostname.

I have some questions for you:

  1. Do you have the $g_from_email set?
  2. What php mailer method do you use? mail(), sendmail, or smtp?
  3. Do you have email enqueuing turned on or off?

I've also attached a patch that achieved the same as in your patch but in a more compact way.

quel

quel

2008-11-14 10:43

reporter   ~0019894

  1. Yes, I have $g_from_email set.
  2. I don't set the mail method but config_defaults_inc.php indicates mail()
  3. I believe this refers to g_email_send_using_cronjob? In which case the default indicates OFF.

Thanks for the much cleaner patch.

quel

quel

2008-12-22 12:44

reporter   ~0020463

Curious on the status of this. I upgraded from 1.1.4 to 1.1.6 but had to manually apply it still.

urkle

urkle

2009-01-08 11:14

reporter   ~0020559

The issue that I am now having with Mantis 1.1.6 (upgraded from 1.1.1) is that the new issue emails now have 2 Message-ID headers which are being rejected by postfix on the system.

Subject: [mod_log_sql 0000094]: UNIX domain socket required for no justified reason
Message-ID: 2bebd857b0e81e50ffca2e48f8159f17@issues.outoforder.cc
X-Priority: 3
X-Mailer: PHPMailer [version 1.73]
keywords: [mod_log_sql] Configuration Issue
Message-ID: <0f7d40612f3c2e7ed7a055259a00aa4e>

I have $g_mail_from set and I have $g_phpMailer_method = 2 (SMTP)

giallu

giallu

2009-01-22 04:55

reporter   ~0020682

I handled this in 0010040 for the 1.2 branch. see 0010040:0020577 for details about the status on the 1.1 branch

giallu

giallu

2009-04-07 03:41

reporter   ~0021411

This is fixed in the 1.2 branch, I'll leave 0010040 open for tracking progress on the 1.1