Sendmail Problem (DSN: Service unavailable)

Here is my problem. Sendmail works just fine if I run a perl script locally while logged in as any user... root or user scripts.

Code:
scripts@server% cat email.pl
#!/usr/bin/perl

my $from = 'abc@xyz.com';
my $to = 'def@uvw.com';
my $subject = "Test Email";
my $message = "Testing email from the server";

my $sendmail = '/usr/libexec/sendmail/sendmail';
open(MAIL, "|$sendmail -oi -t");
print MAIL "From: $from\n";
print MAIL "To: $to\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$message\n";
close(MAIL);

The maillog shows:

Code:
scripts@server% tail /var/log/maillog
Mar  1 18:52:17 server sendmail[2515]: q220qHUo002515: from=scripts, size=124, class=0, nrcpts=1,
 msgid=<201203020052.q220qHUo002515@server.xyz.com>, relay=scripts@localhost
Mar  1 18:52:17 server sendmail[2515]: q220qHUo002515: to=def@uvw.com, ctladdr=scripts (6000/6000), delay=00:00:00,
 xdelay=00:00:00, mailer=relay, pri=30124, relay=smtp.ghi.com. [123.123.123.123], dsn=2.0.0, stat=Sent (q220qHoA023811
 Message accepted for delivery)

And I receive the email just fine about 15 seconds later.

Now here's the problem: I have this system set up as an SNMP trap server. I am able to receive, log, and process the traps as they come in using the perl script below.

Code:
scripts@server% cat /usr/local/share/snmp/snmptrapd.conf
disableAuthorization yes

traphandle default /path_to_directory/traphandler.pl

At the end of the script the same email portion of the perl script above is there. But when the script tries to send an email it shows up in the maillog with a DSN error.

Code:
scripts@server% tail /var/log/maillog
Mar  1 18:55:24 server sendmail[2531]: q220tNMm002531: from=root, size=21395575, class=0, nrcpts=1,
 msgid=<201203020055.q220tNMm002531@server.xyz.com>, relay=root@localhost
Mar  1 18:55:24 server sendmail[2531]: q220tNMm002531: to=def@uvw.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:00,
 mailer=relay, pri=21425575, relay=smtp.ghi.com. [132.201.211.55], dsn=5.0.0, stat=Service unavailable
Mar  1 18:55:24 server sendmail[2531]: q220tNMm002531: q220tNMn002531: DSN: Service unavailable
Mar  1 18:55:24 server sendmail[2531]: q220tNMn002531: to=root, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30000,
 relay=smtp.ghi.com., dsn=2.0.0, stat=Sent (q220tOcY028014 Message accepted for delivery)

I'm not sure where the problem is as I can send email just fine by running the email.pl script. Does it have something to do with the script being run as a trap handle and some weird permission thing or configuration?

Thanks.

[ no fonts, please -- Mod. ]
 
dipdill said:
Code:
relay=smtp.ghi.com. [[b]123.123.123.123[/b]],
{snip}
relay=smtp.ghi.com. [[b]132.201.211.55[/b]],

Note the different IP addresses.
 
Back
Top