SendMailToQueue Method

Send email to EASendMail Service (Mail queuing).

[Syntax]
Visual C++: HRESULT SendMailToQueue( long* pVal )
Visual Basic: SendMailToQueue( ) As Long

Return Values

Return zero if successful, or return non-zero if failed.

Remarks

To learn more detail about SendMailToQueue method, please refer to Work with EASendMail Service (Email Queuing) section.

Example Code

[ASP]
Sub SendMail()
    Dim oSmtp
    Set oSmtp = Server.CreateObject("EASendMailObj.Mail")
    'The license code for EASendMail ActiveX Object,
    'for evaluation usage, please use "TryIt" as the license code.
    oSmtp.LicenseCode = "TryIt"
 
    oSmtp.Charset = "utf-8" 
    
    oSmtp.From      = "Tester"
    oSmtp.FromAddr  = "tester@adminsystem.com"
    
    Dim recipients
    'separate multiple addresses with comman(,)
    recipients = "NickName <to@adminsystem.com>, to1@adminsystem.com, to2@adminsystem.com"
    
    'if you want to EASendMail service send the email after 10 minutes, please use the following code. 
    'oSmtp.Date = DateAdd("n", 10, Now())
        
    oSmtp.AddRecipientEx recipients, 0  ' Normal recipient 
    'oSmtp.AddRecipient CCName, CCEmailAddress, 1 'CC 
    'oSmtp.AddRecipient BCCName, BCCEmailAddress, 2 'BCC 
    'To avoid too many email address in the To header, using the following code can only 'display the current recipient
    oSmtp.DisplayTo = "{$var_rcpt}"
 
    ''Attachs file to this email 'oSmtp.AddAttachment "c:\test.txt"
    
    Dim subject, bodytext
    subject = "test subject"
    bodytext = "Dear {$var_rcptname}, your email address is {$var_rcptaddr}"
    
    oSmtp.Subject   = subject
    oSmtp.BodyText  = bodytext 
    
    Dim hres
    hres = oSmtp.SendMailToQueue()
 
    If hres = 0 Then
        Response.Write "Message was sent to EASendMail service successfully!" 
    Else 
        Response.Write "Error code: " & hres & "Please make sure you installed EASendMail Service on the server!" 'Get last error description 
    End If
End Sub