NullLogic

...

#!/usr/bin/nsp function pop3_sync(user, pass, host, port, use_tls) { var dirname=user; if (!user.endswith(host)) user=user+"@"+host; /* * Both ways work. The first way uses a native C class, * and the second uses a script class in class.pop3.ns. */ dl.load("net"); if (true) { pop=new net.pop3.client(); } else { include("class.pop3.ns"); pop=new POP3(); } pop.username=user; pop.password=pass; pop.host=host; if (port!=null) pop.port=port; if (use_tls!=null) pop.use_tls=use_tls; if (pop.open()) { stat=pop.stat(); count=stat.count; printf("E-mail status for %s\n", dirname); printf("You have %d message%s\n\n", count, (count==1?'':'s')); if (typeof(file.stat(dirname))!='table') file.mkdir(dirname); for (i=1;i<=count;i++) { filename=pop.uidl(i); // pop.head(i); // pop.size(i); if (typeof(file.stat(dirname+"/"+filename))!='table') { file.writeall(dirname+"/"+filename, pop.retr(i)); } } } pop.close(); return; } //pop3_sync('username', 'password', 'hostname.com', 110, false); // start without TLS //pop3_sync('username', 'password', 'hostname.com', 995, true); // start with TLS