OnSent Event


Occur when an email was sent by FastSender object.

[Syntax]
C++: HRESULT OnSent( long lRet, BSTR ErrDesc, long nKey, 
                   BSTR tParam, BSTR Sender, BSTR Recipients )
Visual Basic: Object_OnSent( ByVal lRet As Long, ByVal ErrDesc As String, _
                   ByVal nKey As Long, ByVal tParam As String, _ 
                   ByVal Sender As String, ByVal Recipients As String  )

Parameters

lRet
It is zero if succeeded; otherwise it is non-zero.
ErrDesc
Error description if sending email failed.
nKey
It is equal to the value of nKey parameter specified in Send or SendByPickup method.
tParam
It is equal to the value of tParam parameter specified in Send or SendByPickup method.
Sender
Sender's email address.
Recipients
Recipients' email addresses. Multiple addresses are separated by semicolon(;)

Examples

To get the full samples of EASendMail FastSender, please refer to Samples section.

[VB6, VBA - Send Mass Email with Multiple Threads]
Option Explicit
 
Private WithEvents m_oFastSender As EASendMailObjLib.FastSender
Private m_oSmtp As EASendMailObjLib.Mail
 
Private Sub SendEmail()
  Dim recipientAddr(3) As String
  Dim i As Integer
  
  If m_oFastSender Is Nothing Or m_oSmtp Is Nothing Then
    Set m_oFastSender = New EASendMailObjLib.FastSender
    Set m_oSmtp = New EASendMailObjLib.Mail
  'The license code for EASendMail ActiveX Object, 
   'for evaluation usage, please use "TryIt" as the license code.
    m_oSmtp.LicenseCode = "TryIt"    
    m_oFastSender.MaxThreads = 10 'set the maximum no. of worker threads
  End If
  
  m_oSmtp.FromAddr = "test@adminsystem.net"
  m_oSmtp.ServerAddr = "mail.adminsystem.net"
  'if you don't have a SMTP server, use the following code: 
  'FastSender sends email via DNS lookup 
  'm_oSmtp.ServerAddr = ""
        
  recipientAddr(0) = "test@adminsystem.net"
  recipientAddr(1) = "test1@adminsystem.net"
  recipientAddr(2) = "test2@adminsystem.net"
  
  For i = 0 To 2
    m_oSmtp.ClearRecipient
    m_oSmtp.AddRecipient recipientAddr(i), recipientAddr(i), 0
    m_oSmtp.Subject = "test subject"
    m_oSmtp.BodyText = "test body"
    Call m_oFastSender.Send( m_oSmtp, i, "any" )
  Next
  
End Sub
 
Private Sub m_oFastSender_OnSent(ByVal lRet As Long, _
                                 ByVal ErrDesc As String, _
                                 ByVal nKey As Long, _ 
                                 ByVal tParam As String,  _
                                 ByVal Sender As String, _ 
                                 ByVal Recipients As String)
  If lRet = 0 Then
    MsgBox nKey & " email was sent successfully"
  Else
    MsgBox nKey & ": " & ErrDesc
  End If
End Sub

Online Tutorials

Send Bulk Email with Multiple Threads in Visual C++
Send Bulk Email with Multiple Threads in VB6
Send Bulk Email with Multiple Threads in Delphi

See Also

Programming with FastSender
Work with EASendMail Service(Mail Queuing)