procedure sendmail(ipchar;port:integer);
var
s:tsocket;
server:tsockaddr;
wsa:twsadata;
recvbuffer,sendbuffer:array[0..255] of char;
begin
wsastartup($0101,wsa);
s:=socket(af_inet,sock_stream,0);
if s<>invalid_socket then
begin
server.sin_port:=htons(port);
server.sin_family:=af_inet;
server.sin_addr.addr:=inet_addr(ip);
connect(s,server,sizeof(server),0);
recv(s,recvbuffer,0);
strpcopy(sendbuffer,'HELO'#13#10);
send(s,sendbuffer,6);
//.......相同的道理发送MAIL FROM: YOUR_MAIL_ADDRESS;DATA;QUIT等命令。
end;
closesocket(s);
wsacleanup;
end;