Net::SMTP fails connection in CGI

Discussion in 'Perl Misc' started by CMCLab, Jun 8, 2004.

  1. CMCLab

    CMCLab Guest

    Hello,
    I'm running an IIS server on Windows 2000 with ActiveState Perl
    5.8. I need an automated e-mailer that attaches a PDF file. To do so,
    I'm using MIME::Lite; I need to use Net::SMTP in turn to interface with
    the SMTP server. Whenever I try to instantiate the Net::SMTP object
    through the CGI interface, the following error occurs:

    "Failed to connect to mail server: Unknown error"

    When I run the script from the command line interface, it makes the
    connection fine, and sends the e-mail without problems. However in the
    CGI interface, it fails. This is suggestive of a permissions problem,
    but I'm unclear about which permissions I would have to change if this
    was indeed the case.

    The other thought I had was that going through the CGI interface changes
    my identity to the mail server somehow, and it would no longer know what
    domain I was from - but there is nothing in Net/SMTP.pm that I can see
    that would suggest that.

    I'm running out of ideas. Any thoughts?

    Thanks.

    --
    T. Barrett
     
    CMCLab, Jun 8, 2004
    #1
    1. Advertising

  2. CMCLab

    Matt Garrish Guest

    "CMCLab" <> wrote in message
    news:...
    > Hello,
    > I'm running an IIS server on Windows 2000 with ActiveState Perl
    > 5.8. I need an automated e-mailer that attaches a PDF file. To do so,
    > I'm using MIME::Lite; I need to use Net::SMTP in turn to interface with
    > the SMTP server. Whenever I try to instantiate the Net::SMTP object
    > through the CGI interface, the following error occurs:
    >
    > "Failed to connect to mail server: Unknown error"
    >
    > When I run the script from the command line interface, it makes the
    > connection fine, and sends the e-mail without problems. However in the
    > CGI interface, it fails. This is suggestive of a permissions problem,
    > but I'm unclear about which permissions I would have to change if this
    > was indeed the case.
    >


    CGI processes on IIS run as the IUSR. Check that you allow anonymous access
    to the smtp server (in the snap-in control). If not, enable it and the
    problem should go away. It would also be a good idea to only allow messages
    to be sent from the local machine once you do, though.

    Matt
     
    Matt Garrish, Jun 9, 2004
    #2
    1. Advertising

  3. In article <Uesxc.32750$>, Matt Garrish wrote:
    >
    > "CMCLab" <> wrote in message
    > news:...
    >> Hello,
    >> I'm running an IIS server on Windows 2000 with ActiveState Perl
    >> 5.8. I need an automated e-mailer that attaches a PDF file. To do so,
    >> I'm using MIME::Lite; I need to use Net::SMTP in turn to interface with
    >> the SMTP server. Whenever I try to instantiate the Net::SMTP object
    >> through the CGI interface, the following error occurs:
    >>
    >> "Failed to connect to mail server: Unknown error"
    >>
    >> When I run the script from the command line interface, it makes the
    >> connection fine, and sends the e-mail without problems. However in the
    >> CGI interface, it fails. This is suggestive of a permissions problem,
    >> but I'm unclear about which permissions I would have to change if this
    >> was indeed the case.
    >>

    >
    > CGI processes on IIS run as the IUSR. Check that you allow anonymous access


    That is not always true. You can confugure IIS to run as different IDs and it
    still depends on the type of authentication being done. If NTLM auth is in
    effect, CGI processes run as the authenticated use and NOT the web server
    (anonymous) user.

    This has burned me more than once because I am used to Apache and Unix/Linux...

    > to the smtp server (in the snap-in control). If not, enable it and the
    > problem should go away. It would also be a good idea to only allow messages
    > to be sent from the local machine once you do, though.
    >
    > Matt


    Kevin
     
    Kevin Collins, Jun 9, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    40,653
    Roedy Green
    Nov 16, 2005
  2. Replies:
    3
    Views:
    1,131
    Roedy Green
    Jan 24, 2006
  3. Alex Hunsley
    Replies:
    4
    Views:
    3,682
    Tim Williams (gmail)
    Jun 29, 2004
  4. Raaijmakers, Vincent \(GE Infrastructure\)

    RE: sending of mail (smtp) - connection refused - but smtp serveris running!

    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    912
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
  5. Copelandia Cyanescens

    smtplib.SMTP "no attributes SMTP"

    Copelandia Cyanescens, Jul 31, 2004, in forum: Python
    Replies:
    2
    Views:
    1,575
    Copelandia Cyanescens
    Jul 31, 2004
Loading...

Share This Page