A similar question was posted in January, but I am having a slightly different problem with Mime::Lite. Specifically, I have a CGI script that sends email. in the script, I use very standard code like this:
use strict; use MIME::Lite; # vars defined here for use in the next statement my $msg = MIME::Lite->new ( From => $from_address, To => $to_address, Subject => $subject, Type => $msg_type, Data => $body_text, ); MIME::Lite->send( $method, $host, Timeout=>$timeout ); $msg->send;
I have this in a CGI script. When I run the script on one web server (IIS v5 on Win2K -- sorry, not my choice, but that is what I have), it works perfectly. Sends the email just fine. On another server (also IIS v5 on Win2K), with use CGI::Carp qw( fatalsToBrowser ); I get the following error in the browser:
Failed to connect to mail server: Unknown error

Now here is the odd part... I can run the exact same script from the command prompt (on the same server) as follows:

perl scriptname.pl action=send_msg email=email_address (Simulating a web page passing arguments)

The script works perfectly. It seems odd that the script runs fine on one server, fine from the command prompt on the second, but does not run correctly when run on that server from a web page.

I really do not know what to check next. I appears to be some interaction of the perl script -- specifically the send operation in Mime::Lite -- with the specific installation of IIS. I have looked at various IIS config issues, but nothing seems to explain the problem.

Any insight would be greatly appreciated.

Thanks,

Rick

In reply to Mime::Lite Connection Error by EvR

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.