?
Solved

Sending mail from IIS similar to Unix sendmail

Posted on 1998-02-25
4
Medium Priority
?
213 Views
Last Modified: 2013-12-25
I have written many many cgi scripts to send mail from different unix machines, but now I have a need to move these scrips to an NT 40 server machine running IIS. I would like for the answer to tell me where to get any code required to send mail, and also a snippet of code that calls the routines required to send the mail. Perl is preferred.

Angel
0
Comment
Question by:airborne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Author Comment

by:airborne
ID: 1832039
I quickly increased the points because I want a quick correct answer. I will give more points, depending on the completeness of the answer.

0
 
LVL 1

Expert Comment

by:buemoh
ID: 1832040
Hi airbone,

if you wrote PERL scripts, then you're normaly using the program SENDMAIL, which is available on each unix machine. There are some implementations of SENDMAIL for WindowsNT available on some FTP-servers, but I think, the best way to do ist, build an ISAPI .DLL and use WINSOCK for sending an e-mail.

ISAPI .DLLs can be written with each programming language under WindowsNT, like VC++, BCC++, Delphi 2 or 3, ...

But first, look on the net, there are som good ISAPI implementations to let the user fill in a formular and send it.

If you need an example source, tell me and you'll get it.
0
 
LVL 32

Accepted Solution

by:
jhance earned 400 total points
ID: 1832041
Here's a PERL script that send mail via SMTP to a mail server.  Be careful, however, to choose a PERL port on NT that supports sockets.  Not all do.


#!/bin/perl
# Perl Program to send a message via SMTP

($them, $port) = @ARGV;
$port = 25 unless $port;
$them = 'localhost' unless $them;

$AF_INET = 2;
$SOCK_STREAM = 1;

$sockaddr = 'S n a4 x8';

($name, $aliases, $proto) = getprotobyname('tcp');
($name, $aliases, $port)  = getservbyname($port, 'tcp') unless $port =~ /^\d+$/;;

($name, $aliases, $type, $len, $thisaddr) = gethostbyname('localhost');
($name, $aliases, $type, $len, $thataddr) = gethostbyname($them);

$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);

if(socket(S, $AF_INET, $SOCK_STREAM, $proto)){
  print "socket ok\n";
}
else{
  die $!;
}

if(bind(S, $this)){
 print "bind ok\n";
}
else{
 die $!;
}

if(connect(S, $that)){
  print "connect ok\n";
}
else{
  die $!;
}

select(S); $| = 1; select(STDOUT);

$_ = <S>;
print;
print S "HELO myhost.com\n";
print S "MAIL FROM: myemail@myhost.com\n";
print S "RCPT TO: destemail@desthost.com\n";
print S "DATA\n";
print S "This is just a test message\n";
print S ".\n";
print S "QUIT\n";

print "done\n";

0
 

Expert Comment

by:manningc
ID: 1832042
I have successfully used a freeware program called 'blat'.
I found this utility on the site www.davecentral.com, which
is a software archive site.  The site describes this utlity
thusly:

"Blat is a public domain Windows NT console                      (DOS) utility that sends the contents of a file in                       an e-mail message using the SMTP protocol.                       Perfect for use with CGI scripts that need to                       send e-mail. Source code and sample cgi                       scripts also available. Some users claim it                       works fine in Windows 95 as well."

This utility requires that you first construct
the message in a temporary file, then send it by invoking
the utility.  
0

Featured Post

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question