event Debug (Msg as Message, Description as String)

Fired while the control communicates with the host.

TypeDescription
Msg as Message A Message object being sent.
Description as String A string expression that indicates the command sent to the host, or the reply message from the host. The commands, and replies are conformed to RFC 821, 822.

The Debug event is fired each time when the control sends a command to the SMTP server,or when the SMTP server replies. Also, the Debug event is fired when the control is trying to find the SMTP hosts responsible for the recipent's email address. For instance, if you are trying to send a message "testsss@hotmail.com", the control queries a DNS server for the SMTP hosts that are responsible for the domain email address. Once that DNS replies the SMTP servers, the control is trying one by one SMTP server until the message was delivered successfully. The Debug event shows how delivering the message goes. The following sample displays the SMTP server where the current message is delivered:

Dim WithEvents e As EMail

Private Sub e_Debug(ByVal Msg As EXEMAILLibCtl.IMessage, ByVal Description As String)
    If (Description Like "Trying host:*") Then
        Debug.Print Msg.Subject & " - " & Description
    End If
End Sub

Private Sub Form_Load()

   ' 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", "testsss@hotmail.com", "Test", "The message has one attchament", "c:\winnt\system32\setup.exe"
End Sub