/* checks your e-mail out Usage: pop3 */ parse arg host user pass . if ~show("L","rxsocket.library") then if ~addLib("rxsocket.library",0,-30) then do say "can't find rxsocket.library" exit end if host=="" | host=="?" | user=="" | pass=="" then do say "Usage: pop3 " exit end sock = OpenConnection("tcp","pop3",host) if sock<0 then do select when sock==-3 then say "pop3: service pop3 not found" when sock==-2 then say "pop3: host <" || host || "> not found (" || HostErrorno() || ")" when sock==-1 then say "pop3: unable to connect pop3 service at <" || host || "> (" || errno() || ")" end exit end CRLF = d2c(10) say "pop3: " rec() call sen("USER" user) call rec() call sen("PASS" pass) say "pop3: " rec() call sen("STAT") say "pop3: " rec() call sen("QUIT") say "pop3: " rec() exit sen: parse arg string string = string || CRLF res = send(sock,string) if res~=length(string) then do say "pop3: send error (" || errno() || ")" exit end return rec: len = recv(sock,"BUF",256) if len<0 then do say "pop3: recv error (" || errno() || ")" exit end buf = left(buf,length(buf)-1) if left(buf,4) == "-ERR" then do parse var buf "-ERR "buf say "pop3: error from server" buf exit end parse var buf "+OK "buf return buf