delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/22/17:50:44

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: CYGWIN + APCHE + Net::SMTP
Date: Wed, 22 Sep 2004 14:49:04 -0700
Message-ID: <24BDFF97F1939B44BCBA2E6AADEB0A28233920@mailsc.engineering.netscaler.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Prakash Khemani" <khemani AT netscaler DOT com>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i8MLog9w013610

I have a simple perl mail program mail.pl (pasted at the end of this
mail). In the cygwin environment it is able to send mail out when I run
it from the command line.

I also have apache2 running in my cygwin environment. When I run mail.pl
as a CGI script it is not able to connect to the the smtp server. The
Socket connection is failing (as I noticed after putting some error
prints in SMTP.pm).

The apache server is running as SYSTEM user. In the command line I run
it with user Khemani's permissions.

What could be going wrong?

Thanks,
Prakash

#!/usr/bin/perl
## mail.pl

print "Content-Type: text/plain\r\n\r\n";

$mailHost = "10.10.0.91";
$helloHost = "mydesktop.eng.netscaler.com";

$from = 'khemani AT netscaler DOT com';
@to = ('khemani AT netscaler DOT com');
$smtp = Net::SMTP->new( $mailHost, Hello => $helloHost );
if ($smtp) {
        $smtp->mail($from);
        $smtp->to(@to, { SkipBad => 1 } );
        $smtp->data("ABCD");
        $smtp->dataend();
        if ($smtp->ok()) {
                print "OK\n"; ## comes here at cmd line
        } else {
                print "Not OK\n";
        }
} else {
        print "Not Connected\n"; ## comes here as CGI
}

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019