essej1 has asked for the wisdom of the Perl Monks concerning the following question:
I have a script that sends a spreadsheet to a list of recipients. If I run it from the command line it works just fine. If I run it as a cronjob I get
"FROM: userx@linux.server.com does not end with localhost.localdomain".
I've turned on debugging and I get:
>> 220 int2.disney.pvt ESMTP Sendmail Sentrion-MTA-4.2.2/Sentrion-MTA- +4.2.2; Fri, 21 Jun 2013 12:17:14 GMT << EHLO localhost.localdomain >> 250-int2.disney.pvt Hello linu.server.com [172.27.75.45], pleased t +o meet you >> 250-ENHANCEDSTATUSCODES >> 250-PIPELINING >> 250-8BITMIME >> 250-SIZE 26214400 >> 250-DSN >> 250-ETRN >> 250-STARTTLS >> 250-DELIVERBY >> 250 HELP << MAIL FROM:<userx@xyz..com> >> 550 5.7.1 <userx@xyz.com>... Relaying denied. MAIL FROM: userx.@xy +z.disney.com does not end with localhost.localdomain << quit
The script
#!/usr/bin/perl -w use strict; use Mail::Sender; # need to set PATH for cron? $ENV{'PATH'} = '/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/sb +in:/sbin'; # Get latest KPI spreadsheet my $send_file = 'file_to_send.xls' open my $DEBUG, ">> /tmp/j1.txt" or die "Fail $!\n"; # Set up mail sender my $sender = new Mail::Sender ( { smtp => 'a.relay.server.com', from => 'userx@.xyz.com', debug => $DEBUG, debug_level => 4, }); if ($Mail::Sender::Error) { print "New failed: $Mail::Sender::Error\n"; exit (); } # variables for email # Glenn.Lochen@xerox.com #my $To = q(jesse.carroll@xerox.com, Craig.Elliott@xerox.com); my $To = q(userz.@xyz.com); my $subject = q(A Spreadsheet); my $msg = q(Today's spreadsheet is attached); # send the file $sender->MailFile( { to => $To, subject => $subject, msg => $msg, file => $current_spreadsheet, }); if ($Mail::Sender::Error) { print "Send failed: $Mail::Sender::Error\n"; exit (); } else { print "$current_spreadsheet sent to $To\n"; }
Of course I've change some names. Any help would be greatly appreciated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mail::Sender MAIL FROM: does not end with localhost.localdomain
by walkingthecow (Friar) on Jun 21, 2013 at 14:19 UTC | |
by essej1 (Novice) on Jun 21, 2013 at 15:26 UTC |