Anyone can help me with this Perl script?

##this section looks up the DNS host name of a given IP address use Socket; $gothostbyaddr=gethostbyaddr($address, 2); ##this section forms and email and sends use OLE; $Mailer = CreateObject OLE 'SMTPsvg.Mailer'; $Mailer->{'FromName'} = 'whatevername'; $Mailer->{'FromAddress'} = 'whatever@mysite.com'; $Mailer->{'RemoteHost'} = 'websmtp.mysite.com'; $Mailer->AddRecipient('Recipient', 'receipient@yoursite.com'); $Mailer->{'Subject'} = "Title page"; $Mailer->{'BodyText'} = "$address is $gothostbyaddr"; if ($Mailer->SendMail()) { print "Mail successfully sent", "\n"; } else { print $Mailer->{'Response'},"Mail failure. Check mail host server +name and tcp/ip connection...", "\n"; }

Now, the DNS lookup script works fine by itself without the email script, and the email script works fine by itself without the DNS script, but when they're together like above, only the DNS lookup script works, and the mail section returns the "10057 Socket is not connected" error msg.

I suspect that the DNS lookup script using socket to check DNS interferes with the script's ability to access the mail server. My webhosting service is a small company and they don't know PERL.

Anyone has a clue?


In reply to [10057] socket is not connected error msg by pegasusFlight

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.