next up previous contents
Next: RecvMail Object Up: Events Previous: Events   Contents

onSend

Description

Fired by the send method. The handler function is formed as:

function on_send(type, msg)
{
    body
}

The following table describes the meaning of the parameters.

type msg
0 Represents a socket error message
1 Represents a response of the server
2 Represents a command sent by the SendMail object
3 Represents the bytes sent by the SendMail object


Syntax

sendmail.onSend = handler_function;


Remarks

The handler function must return a Boolean value. Returns true to allow the sending process to continue. Otherwise returns false to terminate the sending process.


Example

var total_bytes = mail.size;
var send_bytes = 0;
sender.onSend = function (type, msg)
{
    if (type == 3)
    {
        send_bytes += parseInt(msg);
        var percent = send_bytes * 100 / total_bytes;

        trace("sent " + percent + "%");
    }
    if (!processMsg()) return false;

    return true;
}
sender.send(mail);




Copyright ©2000-2007 Shanghai TopCMM Software Technologies. All Rights Reserved.