Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Mail::Sender MAIL FROM: does not end with localhost.localdomain

by walkingthecow (Friar)
on Jun 21, 2013 at 14:19 UTC ( [id://1040179]=note: print w/replies, xml ) Need Help??


in reply to Mail::Sender MAIL FROM: does not end with localhost.localdomain

Are you able to check the logs for the mail server? It sounds to me like the mail server is not set up as an open relay, thus when the cronjob tries to send the email, the server is saying no, because the server's hostname is localhost.localdomain, and the @domain.com does not match that. I.e., you're not spoofing an email on this server...

Odd that it would work when not run as a cronjob... Who does the email come from in the actual header when not run as a cronjob? Does it match the address that you're using as the from address in the script?

Also, you may want to edit out those @xerox.com email addresses. I doubt those people want their email addresses put on here.

Replies are listed 'Best First'.
Re^2: Mail::Sender MAIL FROM: does not end with localhost.localdomain
by essej1 (Novice) on Jun 21, 2013 at 15:26 UTC

    The debug output file eventually pointed me where I should have gone. It turns out that the Mail::Sender module calls 'gethostbyname' which apparently yields the server name when run from the command line but returns "localhost.localdomain" when using cron. Not sure why though. The fix is to add a 'client' line in the new method.

    my $sender = new Mail::Sender ( { smtp => 'a.relay.server.com', from => 'userx@.xyz.com', client => 'linux.server.com', debug => $DEBUG, debug_level => 4, });

    All works now.

    Paradise: Florida, full tank of gas, no appointments.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1040179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-29 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found