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
Return Value
Remarks
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