Rt2 SendmailArguments only honors first argument?

It appears that in rt2 the $RT::SendmailArguments only honors the first
argument given it.

We got notice from some idiot ISP that they block all messages with
SMTP sender www@ in the theory that it is some sort of
infected machine. Right. So I needed to change the sender of all RT
originated messages, since the web server runs as user www.

My first try was this:

$SendmailArguments=“-oi -f$CorrespondAddress”;

That is, I just added -f$CorrespondAddress to the existing “-oi”.

However, the sender address reported in the mail logs was still www@
which seemed strange. So then I tried this:

$SendmailArguments=“-f$CorrespondAddress -oi”;

Now suddenly the sender address was reported properly. However, I’m
afraid that the -oi flag may be ignored, which could potentially cause
problems. Yes, I did stop and restart the httpd between every config
file change. My mailer is postfix, in case it happens to be a
difference between Sendmail brand “sendmail” and postfix’ “sendmail”.

I haven’t looked into how RT3 handles the sending of mail, but if it is
still using MIME::Entity->send() as inherited from Mail::Internet and
Mail::Mailer, I suspect it will also suffer this problem. It appears
to me that perhaps SendmailArguments should be split into an array
rather than being copied into $RT::MailParams verbatim. I haven’t
tested this theory, though.

Anyone else run into anything similar?

Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-301-869-4449 x806
AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/

Vivek Khera wrote:

It appears that in rt2 the $RT::SendmailArguments only honors the first
argument given it.

Can you verify this, say, by pointing $SendmailPath to
a wrapper script and capturing the args it sees?
Phil Homewood, Systems Janitor, http://www.SnapGear.com
pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - A CyberGuard Company

Vivek Khera wrote:

It appears that in rt2 the $RT::SendmailArguments only honors the
first
argument given it.

Can you verify this, say, by pointing $SendmailPath to
a wrapper script and capturing the args it sees?

I wrote a small test program:

–cut here–
#!/usr/local/bin/perl -wT
use strict;

use MIME::Entity;

my $entity = MIME::Entity->build( Type =>“multipart/mixed”,
From => ‘vivek@khera.org’,
Bcc => undef,
To => ‘khera@kcilink.com’,
Subject => ‘SnuffyFunk’,
‘X-RT-Loop-Prevention’ => ‘RT2’,
);

$entity->attach( Data => “This is my sample message.\n”);

#$entity->send(‘sendmail’, ‘-oi -fnobody@example.com’);
$entity->send(‘sendmail’, ‘-fnobody@example.com -oi’);
–cut here–

When you run this on the command line, you see the warning from the
sendmail program (Postfix’ version of “sendmail”):

sendmail: warning: -f option specified malformed sender:
nobody@example.com -oi

It is apparent that the argument is passed as a single value, not split
as multiple arguments. Ie, it is as if you ran this on the command
line:

/usr/sbin/sendmail ‘-fnobody@example.com -oi’

When you run it with the commented send line above you’ll see your own
sender address rather than nobody@example.com.

Changing it to something like this seems to work by passing all
arguments to the sendmail program individually. Naturally, this
doesn’t take into account any quoting that may be present in the
argument list…

$entity->send(‘sendmail’, split(/ /,‘-oi -fnobody@example.com’));

So I’ll say it is definitely a bug in how RT2 is using the Mail::Mailer
API. The second arg to send() needs to be a list, not a string, for
multiple arguments.

Does RT3 do this as well? If so, I can file a bug report (or you can
feel free to do so on my behalf).

Vivek Khera wrote:

It appears that in rt2 the $RT::SendmailArguments only honors the
first
argument given it.

Can you verify this, say, by pointing $SendmailPath to
a wrapper script and capturing the args it sees?

I wrote a small test program:

–cut here–
#!/usr/local/bin/perl -wT
use strict;

use MIME::Entity;

my $entity = MIME::Entity->build( Type =>“multipart/mixed”,
From => ‘vivek@khera.org’,
Bcc => undef,
To => ‘khera@kcilink.com’,
Subject => ‘SnuffyFunk’,
‘X-RT-Loop-Prevention’ => ‘RT2’,
);

$entity->attach( Data => “This is my sample message.\n”);

#$entity->send(‘sendmail’, ‘-oi -fnobody@example.com’);
$entity->send(‘sendmail’, ‘-fnobody@example.com -oi’);

What about:

$entity->send(‘sendmail’, ‘-f"nobody@example.com" -oi’);

?

Jesse

What about:

$entity->send(‘sendmail’, ‘-f"nobody@example.com" -oi’);

sendmail: warning: -f option specified malformed sender:
nobody@example.com” -oi

I didn’t expect it to work since you’re already inside a single-quote.
The list of arguments must be broken into a list from how I read the
source for the Mail::Internet and Mail::Mailer modules.

Vivek Khera, Ph.D.
+1-301-869-4449 x806