Repost: Sendmail & Win95/98greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread |
Ok... here is the only code that I found that will send out mail on Win95/98 systems... Can anyone convert it to replace the coding in S-Mart that uses sendmail....I have yet to get any sendmail code to work!
Here is the code that works:
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); }
-- Dave (Dave@cdlc.com), January 05, 1999
Dave, This isn't the answer you want, but I got tired of struggling with hacking socket routines (using Xitami and Win95) to replace sendmail. I bit the bullet and got Windmail (http://www.geocell.com). It's a virtual drop-in replacement for sendmail in CGI scripts. Yep, I tried blat, wsendmail and several other command line mailers.It's pricey at $129.00, but I figure on saving that much in aspirins and time saved.
-- Ken Sukimoto (sysop@dwntwn.com), February 08, 1999.