Net::SMTP fails connection in CGI

C

CMCLab

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.
 
M

Matt Garrish

CMCLab said:
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
 
K

Kevin Collins

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Net::SMTP connection problems 4
Net::SMTP errors 3
Net::SMTP fails 9
Net::SMTP problem 1
Net::SMTP module error 5
Net::SMTP - "Bad File Number" error ? 2
Apache+Perl Net::SMTP Strange problem 3
Net::SMTP 0

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top