Win95/98...

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread

Ok... Win95 and 98, AND NT do not use sendmail... so is there a modification so the CGI uses sockets and talks directly to mail servers... like the code that follows that was taken from a auction CGI program....: (I am not a programmer)

############################################## # SUB: Send E-mail # This is a real quick-and-dirty mailer that # should work on any platform. It is my first # attempt to work with sockets, so if anyone # has any suggestions, let me know! # # Takes: # (To, Subject, Reply-To, IP ADDRESS of SMTP host, Message)

sub sendemail { use Socket; $TO=$_[0]; @TO=split('\0',$TO); $SUBJECT=$_[1]; $REPLYTO=$_[2]; $REMOTE = $_[3]; $THEMESSAGE = $_[4]; if ($REMOTE =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { $addr = pack('C4', $1, $2, $3, $4); } else { die("Bad IP address: $!"); } $port = 25 unless $port; $port = getservbyname($port,'tcp') if $port =~ /\D/; $proto = getprotobyname('tcp'); socket(S, PF_INET, SOCK_STREAM, $proto) or die("Socket failed: $!"); $sockaddr = 'S n a4 x8'; # shouldn't this be in Socket.pm? connect(S, pack($sockaddr, AF_INET, $port, $addr)) or die("Unable to connect: $!");

select(S); $| = 1; select(STDOUT); $a=; print S "HELO mail.cdlc.com\n"; $a=; print S "MAIL FROM:\n"; $a=; print S "RCPT TO:<$TO[0]>\n"; $a=; if ($#TO > 0) { foreach (1..$#TO) { print S "RCPT TO: $TO[$_]\n";$a=; } } print S "DATA \n"; $a=; print S "To: $TO[0]\n"; if ($#TO > 0) { foreach (1..$#TO) { print S "Cc: $TO[$_]\n"; } } print S "Subject: $SUBJECT\n"; print S "Reply-To: $REPLYTO\n";

# Print the body print S "$THEMESSAGE\n"; print S ".\n"; $a=; print S "QUIT"; close (S); }

This way, this grogram would run on ALL systems... no dependence on thazt trash sendmail...

Thanks

-- Dave De Wald (dave@cdlc.com), January 05, 1999


Moderation questions? read the FAQ