Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Bad hostname 'mailhost'

by talexb (Canon)
on Mar 26, 2002 at 16:58 UTC ( #154441=perlquestion: print w/ replies, xml ) Need Help??
talexb has asked for the wisdom of the Perl Monks concerning the following question:

I have written a script that will send out a weekly updated via E-Mail using Mail::Internet; it works fine except that I get the following output:
Net::SMTP: Bad hostname 'mailhost' at blib/lib/Mail/Internet.pm (autos +plit into blib/lib/auto/Mail/Internet/smtpsend.al) line 577 Net::SMTP: Bad hostname 'mailhost' at blib/lib/Mail/Util.pm (autosplit + into blib/lib/auto/Mail/Util/maildomain.al) line 176
It appears that this is a warning only -- the E-Mail arrives properly, but I would like to see if there is a way to resolve the problem, since my preferred operation is without warnings.

I have search on PM and on Google: I tried substituting 'localhost' in the my $Message = Mail::Internet->new(); call, and that got rid of the warning from Net::SMTP but instead I got the message Can't use string ("localhost") as a symbol ref while "strict refs" in use at /usr/lib/perl5/Mail/Internet.pm line 68. --t. alex

"Here's the chocolates, and here's the flowers. Now how 'bout it, widder hen, will ya marry me?" --Foghorn Leghorn

Comment on Bad hostname 'mailhost'
Select or Download Code
Re: Bad hostname 'mailhost'
by shotgunefx (Parson) on Mar 26, 2002 at 17:27 UTC
    I'm using an older version 1.33 but it looks like that if no host is passed it checks mailhost and then localhost. So mailhost is probably failing but localhost succeeds.

    -Lee

    "To be civilized is to deny one's nature."
      I have version 1.32 (I'm stuck with that version for now) -- so is this a warning that I can safely ignore?

      I don't mind seeing a warning as long as I know it's relatively benign.

      --t. alex

      "Here's the chocolates, and here's the flowers. Now how 'bout it, widder hen, will ya marry me?" --Foghorn Leghorn

        If it's working then I'd say yes. What I'd do is open up the .pm file in vi/emacs/pico and look at the line in question. If you see something like the following, it just means that it's trying mailhost first and it's failing.
        unless(defined($host)) { local $SIG{__DIE__}; my @hosts = qw(mailhost localhost); unshift(@hosts, split(/:/, $ENV{SMTPHOSTS})) if(defined $ENV{S +MTPHOSTS}); foreach $host (@hosts) { $smtp = eval { Net::SMTP->new($host, @hello) }; last if(defined $smtp); } }
        If you are the sysadmin, you could just remove the mailhost out of the qw() or set up the alias for mailhost in /etc/hosts. Another way to supress the warning would be to specify loclhost in $ENV{SMTPHOSTS}.

        -Lee

        "To be civilized is to deny one's nature."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://154441]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-07-25 04:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls