This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

CYGWIN + APCHE + Net::SMTP


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@netscaler.com';
@to = ('khemani@netscaler.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]