Occurs during sending the message, while the sending's state is changing/changed.
Type | Description | |||
Msg as Message | A Message object that contains the email message being sent to the SMTP server. | |||
NewState as SendStateEnum | A SendStateEnum expression that indicates the state of the sending operation. |
The StateChange event is fired each time when the sending state is changing/changed. Use the Debug event to debug sending a message. Here are the steps that the ExEMail component follows in order to deliver an email message:
The events are fired only if the Notifier property points to an EMail object. For instance the following sample displays the message's state during sending:
Dim WithEvents e As EMail Private Sub e_StateChange(ByVal Msg As EXEMAILLibCtl.IMessage, ByVal NewState As EXEMAILLibCtl.SendStateEnum) Select Case NewState Case SendStateEnum.LookupMX Debug.Print "LookupMX" Case SendStateEnum.Connected Debug.Print "Connected" Case SendStateEnum.Connecting Debug.Print "Connecting" Case SendStateEnum.Opening Debug.Print "Opening" Case SendStateEnum.Opened Debug.Print "Opened" Case SendStateEnum.Data Debug.Print "Data" Case SendStateEnum.Closing Debug.Print "Closing" Case SendStateEnum.Closed Debug.Print "Closed" Case SendStateEnum.Disconnecting Debug.Print "Disconnecting" Case SendStateEnum.Disconnected Debug.Print "Disconnected" End Select 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 "m@malibu.com", "marfa@cool.com", "Test", "The message has one attchament", "c:\winnt\system32\setup.exe" End Sub