[Message modified slightly to protect the guilty.] Date: Sun, 16 Jul 2006 17:07:35 -0400 From: darkness To: rt-bugs@fsck.com Subject: MAILADDRESS environment variable given improper value lib/RT/Action/SendEmail.pm around line 289 executes the following if $RT::MailCommand == 'smtp': $ENV{MAILADDRESS} = $RT::SMTPFrom || $MIMEObj->head->get('From'); In my installation, $MIMEObj->head->get('from') returns a string like (presented here as a Perl string): "Brief queue description" \n" This newline is a problem. If left in, the resulting message from RT will have a header that looks like: Sender: Apache The ">" on a line by itself makes an invalid header. In the case of my MTA/MUA (Postfix or Mutt; I'm not sure which one made the change) the ">" is interpreted as the first line of the message body, so I get some things like the "From" header and the "*RT*" headers in the body of the message. I've included one possible (simple) patch for this problem below. Further analysis: If the newline is left in, Mail::Internet::_prephdr gets called, which finds the "From" header as set by RT, but no "Sender" header. It then proceeds to compose its own "Sender" header by using the GECOS field for the current user and an e-mail address gleaned (by way of Mail::Util::mailaddress) from the MAILADDRESS environment variable. Mail::Util::mailaddress does its best to strip out everything outside and including the <>'s, but fails to address newline characters. So the newline stays in and you end up with the invalid header shown above. Another fix would probably be to just have RT set the "Sender" header to the value of the "From" header. Of course, one could also blame MailTools for allowing you to produce an invalid message. Versions (RPM versions in parenthesis): CentOS 4.3 mod_perl 2.0.1 (mod_perl-2.0.1-1.fc4) Apache 2.0.52 (httpd-2.0.52-22.ent.centos4) RT 3.6.0 perl 5.8.5 (perl-5.8.5-24.RHEL4) MailTools 1.74 darkness --- lib/RT/Action/SendEmail.pm 2006-01-19 10:11:21.000000000 -0500 +++ /home/darkness/SendEmail.pm 2006-07-16 16:56:55.000000000 -0400 @@ -287,6 +287,7 @@ } elsif ( $RT::MailCommand eq 'smtp' ) { $ENV{MAILADDRESS} = $RT::SMTPFrom || $MIMEObj->head->get('From'); + $ENV{MAILADDRESS} =~ s/\n//gs; push @mailer_args, ( Server => $RT::SMTPServer ); push @mailer_args, ( Debug => $RT::SMTPDebug ); }