use Socket; use strict; my($mailTo) = 'me@here'; my($mailServer) = 'host.there'; my($mailFrom) = 'me@here'; my($realName) = "Ralph Martin"; my($subject) = 'Test'; my($body) = "Test Line One.\nTest Line Two.\n"; $main::SIG{'INT'} = 'closeSocket'; my($proto) = getprotobyname("tcp") || 6; my($port) = getservbyname("SMTP", "tcp") || 25; my($serverAddr) = (gethostbyname($mailServer))[4]; if (! defined($length)) { die('gethostbyname failed.'); } socket(SMTP, AF_INET(), SOCK_STREAM(), $proto) or die("socket: $!"); $packFormat = 'S n a4 x8'; # Windows 95, SunOs 4.1+ #$packFormat = 'S n c4 x8'; # SunOs 5.4+ (Solaris 2) connect(SMTP, pack($packFormat, AF_INET(), $port, $serverAddr)) or die("connect: $!");