Description
Fired when recieving mails. The handler function is formed as:
function on_recv(type, msg)
{
body
}
The following table describes the meaning of the parameters.
type msg 0 Represents a socket error message 3 Represents the bytes recieved by the retr method
Remarks
The handler function must return a Boolean value. Returns true to allow the recieving process to continue. Otherwise returns false to terminate the recieving process.
Syntax
recvmail.onRecv = handler_function;
Example
var old_p = 0, p, size;
pop.onRecv = function on_recv(type, msg)
{
if (type == 0) trace(msg);
else if (type == 3)
{
p = parseInt(msg) * 100 / size;
if (p - old_p > 10)
{
trace("recieved: " + p + "%");
old_p = p;
}
}
if (!processMsg()) return false;
return true;
}
trace(pop.connect());
size = parseInt(pop.list(1));
trace(size);
m = pop.retr(1);
pop.quit();
pop.close();
m.save("c:\\test\\3.eml");