event Data (Msg as Message, Percent as Double, Cancel as Boolean)

Occurs during sending the message's data.

TypeDescription
Msg as Message A Message object being sent.
Percent as Double A double value that indicates the percent of the data sent. The valid range is [0..100].
Cancel as Boolean A boolean reference to let user cancels sending the message.

The Data event is fired each time when a new line of message's data was sent to the host. The Data event is fired only if the Notifier property points to the EMail object. The Percent value specifies the amount of data in % that has been already delivered. Use Data event to provides progress capabilities to your application. You can cancel sending the message's data by changing the Cancel value to True. We cannot guarante that the message can be canceled. It depends on SMPT server implementation. The following sample shows how to add progress capabilities to your form. In order to run the following sample your form requires a   Microsoft ProgressBar ActiveX control, or something similar:

Dim WithEvents e As EMail

Private Sub e_BeginSend(ByVal Msg As EXEMAILLibCtl.IMessage)
    Debug.Print Msg.Subject & " message begins. "
End Sub

Private Sub e_Data(ByVal Msg As EXEMAILLibCtl.IMessage, ByVal Percent As Double, Cancel As Boolean)
    ProgressBar1.Value = Percent
End Sub

Private Sub e_Debug(ByVal Msg As EXEMAILLibCtl.IMessage, ByVal Description As String)
    Debug.Print Msg.Subject & " DEBUG: " & Description
End Sub

Private Sub e_EndSend(ByVal Msg As EXEMAILLibCtl.IMessage)
    Debug.Print Msg.Subject & " message ends."
End Sub

Private Sub Form_Load()
    ProgressBar1.Min = 0
    ProgressBar1.Max = 100

    ' Creates an EMail object, that will receive Message notifications
    Set e = Runtime1.NewEMail()
    ' Creates a Message object
    Dim m As Message
    Set m = Runtime1.NewMessage()
    ' Message' notifications are sent through EMail object
    Set m.Notifier = e

    ' Sends a message to one user
    m.Send "me@malibu.com", "testttt@hotmail.com", "Test", "The message has one attchament", "c:\winnt\system32\setup.exe"

End Sub