Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CGI, Send mail and windows 2000

Status
Not open for further replies.

jaxjedi

IS-IT--Management
May 7, 2004
4
US
I am writing due to some difficulty I am having with a form I am writing. I have a windows 2000 server, a email form written and working, I have installed active perl, obtained NTsend mail (indigo) and a cgi/pl script.

Send mail is configured and able to send test messages to the web server (separate server) and the form will submit to the cgi-bin/mail.pl but nothing from their.
I am told that this is not going to work on a windows machine, I think it will.

I am looking for some direction on what to do in my script and sendmail configuration to get this working. I am about 10 min from switching to PHP but the client wants it done this way.

HELP!! I have been all over the internet and I must be missing the boat somewhere.

Frantic!
 
Did you pay for sendmail?

All over this board there are references to Net::SMTP as being streets ahead of sendmail on *nix platforms, haven't used indigo's so can't be sure.

Net::SMTP afaik, lets you specify an SMTP host, eg, a dedicated mail server, and you can send mails from there

Have a look at search.cpan.org

HTH
--Paul
 
With Net:SMTP, you must specify the server. Here's a brief example:

Code:
my $email = "abc@xyz.com";
my $ServerName = "smtp.yourdomain.com";
my $MailTo = "info\@yourdomain.com"; 
$smtp = Net::SMTP->new($ServerName); 
die "Couldn't connect to server" unless $smtp;

$smtp->mail( $email );  
$smtp->to( $MailTo ); 

# Start the mail  
$smtp->data(); 
$smtp->datasend("To: $MailTo\n"); 
$smtp->datasend("From: $email\n");  
$smtp->datasend("Subject: Request for Information\n");  
$smtp->datasend("The body of the message goes here...
.
.
.

# Send the termination string  
$smtp->dataend(); 

# Close the connection  
$smtp->quit();

There's always a better way. The fun is trying to find it!
 
Thanks,

I will investigate the Net::SMTP, although I have the sendmail able send a test message, I am having the disconnect between the script and the application.

I was starting to look at PHP though.
 
Why would you look at PHP? It will have the same issues as perl with sendmail. Just use Net::SMTP and your good to go. Or its PHP equivelant.
 
If you combine the usefulness of Mime::Lite with Net::SMTP, you can do some pretty great things, including sending file attachments.

Code:
my $msg = MIME::Lite->new(	From => "$email\@myisp.com",
				To => "$to\@yourisp.com",					Cc => "$cc",							Subject => "$subject",						Type => 'multipart/mixed',
			Date => scalar(localtime));

foreach my $file (@files)
{
	### Add the Attachment:
	$msg->attach(	Type => 'BINARY',						Path => "$outputdir/$file",					Filename => $file1,						Disposition => 'attachment');
}

my $message = $msg->as_string;

$smtp->mail("$mailowner");

$smtp->to("$to\@yourisp.com");

foreach my $cc_list (@cc_list)
{
	$smtp->cc("$cc_list");
}

$smtp->data();

$smtp->datasend("$message");

$smtp->quit();

- Rieekan
 
See,

Told you Net::SMTP was much advocated in these here parts

:p

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top