/* Reads mail over POP3 protocol. run like this: anettest -f this_file.fws */ string currentNumberOfMessages = '0' .nummes '' // field that will hold number of messages, position and size will be set later timeout 5000 cyc inf { print "new connection...\n" open tcp "client:pop3.mail.ru:110#session" // opens TCP session recv if data != '+OK\r\n' { print "The server doesn't send invitation\n" exit 2 } data 'user anettesttesting\r\n' send recv if data != '+OK\r\n' { print "User name is not accepted\n" exit 2 } data 'pass anettest\r\n' send recv goto ('+OK') if gotores = 0 { print 'received $data$' exit 2 } data 'stat\r\n' send recv goto ('+OK') if gotores = 0 { printl 'received wrong $data$' exit 2 } pass 4 int start = curpos goto (' ') int end = curpos end -= start setpos nummes start setsize nummes end printl 'nummes = $nummes$' if (nummes != currentNumberOfMessages) { //beep beep beep play 'Media/Windows Exclamation.wav' printl 'NEW MESSAGES' } currentNumberOfMessages = nummes data "quit\r\n" send close session printl "wait before next connection" pause 10000 }