PostToRemoteQueue Method


Send email to remote EASendMail Service (Email Queuing).

[Syntax]
Visual C++: HRESULT PostToRemoteQueue(BSTR Instance, BSTR URL, BSTR User, BSTR Password, long* pVal)
Visual Basic: PostToRemoteQueue(Instance As String, URL As String, User As String, Password As String) As Long

Parameters

Instance
A String value used to specify EASendMail Service instance. Null string means default instance.
URL
A String value used to specify EASendMail Service Remote Agent URL.
User
A String value used to specify Remote Agent URL user name (optional).
Password
A String value used to specify Remote Agent URL password (optional).

Return Value

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

Remarks

EASendMail Service is a light and fast email delivery service which works with EASendMail SMTP .Net Component / ANSMTP SMTP Component to enable your application to send mass emails in background service. Along with its ability to picking recipients from database in background and sending email in specified datetime, it eases your task in developing featured email application such as newsletter application. We strongly recommend you to use EASendMail Service with your ASP/Web Application. To learn more detail about SendMailToQueue method, please refer to Work with EASendMail Service (Email Queuing) section.
If your application is running on the same server of EASendMail Service, then please use SendMailToQueue or SendMailToQueueEx method; If your appliation want to send email to EASendMail Service on remote server, you should use this method.
Before you use PostToRemoteQueue method, you should deploy EASendMail Service Agent on the remote server.

Example

[ASP/VBScript] The following example demonstrates how to send email with EASendMail SMTP Component. To get the full samples of EASendMail, please refer to Samples section.

[ASP, VBScript - Send Email to Remote Queue]

Const ConnectNormal = 0
Const ConnectSSLAuto = 1
Const ConnectSTARTTLS = 2
Const ConnectDirectSSL = 3
Const ConnectTryTLS = 4

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"
 
    ' Your SMTP server address
    ' If you don't set server, EASendMail service uses the server setting in EASendMail Service Manager.
    oSmtp.ServerAddr = "smtp.emailarchitect.net"

    ' User and password for ESMTP authentication
    oSmtp.UserName = "test@emailarchitect.net"
    oSmtp.Password = "testpassword"

    ' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically
    oSmtp.ConnectType = ConnectTryTLS

    oSmtp.Charset = "utf-8" 
    
    oSmtp.From      = "Tester"
    oSmtp.FromAddr  = "tester@emailarchitect.net"
    
    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}"

    ' attaches 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 
    
    ' Send email to remote easendmail service queue
    Dim hres
    hres = oSmtp.PostToRemoteQueue("", "http://192.168.0.1/eaagent/", "", "" )

    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

See Also

Work with EASendMail Service (Email Queuing)
SendMailToQueue Method
SendMailToQueueEx Method

Online Tutorials

Send Email in MS SQL Server - Tutorial
Send Email with Queue in ASP.NET + C#
Send Bulk Emails with Database Queue in ASP.NET + C#
Send Email with Queue in ASP.NET + VB
Send Bulk Emails with Database Queue in ASP.NET + VB
Send Email with Queue in ASP + VBScript
Send Bulk Emails with Database Queue in ASP + VBScript

Online Examples

VB6 - Email Queue with EASendMail Service
VB6 - Email Queue with Database
VC++ - Email Queue with EASendMail Service
VC++ - Email Queue with Database
Delphi - Email Queue with EASendMail Service
Delphi - Email Queue with Database