EASendMailObj consists of two objects: IMail and IFastSender. IMail interface provides the basis of sending email. It supports CC, BCC, multiple attachments and ESMTP authentication. It fully supports asynchronous operating mode and event driving. It also provides advanced features such as embedded picture, alternative text, email digital signature and email encryption. IFastSender interface enables your application to send mass email in a threadings-pool with highest performance. Both IMail and IFastSender can send email under SSL/TLS channel.
Properties
Alias |
Specifies user alias in Exchange WebDAV protocol. |
AltBody |
Specifies alternative text/plain body of current email. |
Anonymous |
Specifies whether sender's address will be displayed in email |
Asynchronous |
Specifies the operation mode of current object. |
AuthType |
Specifies the type of ESMTP authentication. |
AutoCalendar |
Specifies the e-mail generates text/calendar body with ics attachment automatically. |
BodyFormat |
Specifies current email body text format. |
BodyText |
Specifies current email body text. |
Charset |
Specifies the character set in current email. |
ComputerName |
Domain name to send in HELO/EHLO command. |
ConnectType |
TCP connection type to server (Plain/SSL/TLS). |
DeliveryNotification |
Sets the delivery notifications for this e-mail message. |
DK_PublicKey |
Gets the latest DomainKeys publick key. |
Drafts |
Specifies the user drafts folder in Exchange WebDAV protocol. |
EncryptionAlgorithm |
Specifies the algorithm for email encryption. |
From |
Specifies the original display name of email sender. |
FromAddr |
Specifies the original sender's email address. |
HeaderEncoding |
Sets the encoding method of email sender name, recipient name, subject and attachments' name. |
KeepConnection |
Specifies whether EASendMail disconnects to server after sending an email. |
LocalIP |
Specify the IP address of local computer to connect server. |
LogFileName |
Log file to record all transactions between client and server. |
Protocol |
Specifies the server protocol (SMTP/Exchange Web Service/Exchange WebDAV). |
ProxyProtocol |
Specifies the proxy server protocol (socks4/socks5/http). |
ReadReceipt |
Request read receipt in the email message. |
RecipientsCerts |
Specifies the certificates of recipients to encrypt current email. |
LicenseCode |
License code of EASendMail Object. |
PIPELINING |
Gets or sets using PIPELINING extension with SMTP server. |
ReplyTo |
Reply address of current email. |
ReturnPath |
Specifies the email address for delivery notification report. |
SaveCopy |
Specifies if server should save a copy of message in sent folder. |
Sender |
Specifies the sender's email address. |
ServerAddr |
SMTP server address, it can be IP address or domain name. |
ServerPort |
Listening port of SMTP server. |
SignatureHashAlgorithm |
Specifies the has algorithm for email digital signature. |
SignerCert |
Specifies the Digital Signature of current email. |
SocksProxyServer |
Specifies socks4/socks5/http proxy server address. |
SocksProxyPort |
Specifies socks4/socks5/http proxy port. |
SocksProxyUser |
Specifies the user for user authentication of proxy server. |
SocksProxyPassword |
Specifies the password for user authentication of proxy server. |
Subject |
Subject of current email. |
SSL_starttls |
Specifies whether current connection uses STARTTLS command to enable SSL/TLS. This property is obsoleted by ConnectType property. |
TransferEncoding |
Specifies the encoding method of email body. |
Priority |
Specifies the priority level of current email. |
Timeout |
Specifies the timeout value in seconds. |
UserName |
User name for ESMTP authentication. |
Password |
Password for ESMTP authentication. |
raw_Content |
Sends an email with 100% original format. |
Methods
AddAttachment |
Attach a file or URL to current email. |
AddAttachment1 |
Attach a binary stream to current email with customized file name. |
AddAttachmentEx |
Attach a file or URL to current email with customized file name. |
AddAttachments |
Attach all files in specified directory to current email. |
AddHeader |
Add customized header to current email. |
AddInline |
Add an embedded attachment file to current email. |
AddInlineEx |
Add an embedded attachment file to current email with customized file name. |
AddRecipient |
Add normal, carbon copy or blind carbon copy recipient to current email. |
AddRecipientEx |
Add multiple normal, carbon copy or blind carbon copy recipients to current email. |
ClearAttachment |
Remove all attachments from current email. |
ClearHeader |
Remove all customized headers from current email. |
ClearInline |
Remove all embedded attachments from current email. |
ClearRecipient |
Remove all recipients from current email. |
ConvertHTML |
Convert BodyText to text format and remove all html tags from message. |
CreateFolder |
Create a folder in local disk recursively. |
DeleteFile |
Delete specified file from local disk. |
GetAllEmailServers |
Retrieve all recipient's local SMTP server addresses via DNS lookup. |
GetEmailContent |
Get current email's encoded content. |
GetEmailHeaders |
Get text stream of current email headers. |
GetEmailServer |
Retrieve recipient's SMTP server address via DNS lookup. |
GetLastError |
Get latest error code while sending email. |
GetLastErrDescription |
Get latest error descriptions. |
ImportHtml |
Imports specified html string with embedded pictures to current email. |
ImportMail |
Import the content of a file or URL to BodyText. |
ImportMailEx |
Imports specified html file or URL with embedded pictures to current email. |
LoadMessage |
Load email from a *.eml file to current object. |
LoadRawMessage |
Load email from a *.eml file to raw_Content property and send it with 100% original format. |
PostToRemoteQueue | Send email message to remote EASendMail Service queue. |
Reset |
Reset most properties to their default values and remove all recipients, attachments. |
SaveMail |
Save current email to specified email file. |
SaveMailEx |
Save current email to IIS SMTP Service pickup path. |
SetMailer |
Specify x-mailer in email header. |
SendMail |
Send email to specified SMTP server. |
SendMailToQueue |
Sends an email to EASendMail Service. |
SendMailToQueueEx |
Sends an email to specified instance of EASendMail Service. |
SSL_init |
Initializes security library for SMTP SSL/TLS connection. This property is obsoleted by ConnectType property. |
SSL_uninit |
Unload security library for SMTP SSL/TLS connection. This property is obsoleted by ConnectType property. |
Terminate |
Terminate incomplete SendMail method in asynchronous mode. |
TestEmailAddr |
Test if an email address is valid. |
Events
OnAuthenticated |
Occur when ESMTP user authentication is successful. |
OnClosed |
Occur when the connection to server closes. |
OnConnected |
Occur when the client successfully connects to server. |
OnError |
Occur when there is an error in sending email. |
OnSending |
Occur when EASendMail is sending email's content to SMTP server. |
Example
[Visual Basic 6.0, C++, JScript, Delphi] The following example demonstrates how to send email with EASendMail SMTP Component, but it doesn't demonstrates the events usage. To get the full samples of EASendMail, please refer to Samples section.
[VB6, VBA - Send Email] Const ConnectNormal = 0 Const ConnectSSLAuto = 1 Const ConnectSTARTTLS = 2 Const ConnectDirectSSL = 3 Const ConnectTryTLS = 4 Private Sub SendEmail() Dim oSmtp As EASendMailObjLib.Mail Set oSmtp = New EASendMailObjLib.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 oSmtp.ServerAddr = "smtp.emailarchitect.net" ' If you don't have SMTP server, use the following codes to send email via DNS lookup ' It is not recommended, most email providers would reject the email for anti-spam policy ' oSmtp.ServerAddr = "" ' User and password for ESMTP authentication ' If your server doesn't require user authentication, please remove the following codes oSmtp.UserName = "test@emailarchitect.net" oSmtp.Password = "test" ' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically oSmtp.ConnectType = ConnectTryTLS ' If your server uses 587 port ' oSmtp.ServerPort = 587 ' If your server uses 465 port with SSL/TLS ' oSmtp.ConnectType = ConnectSSLAuto ' oSmtp.ServerPort = 465 ' If your server uses 25/587 port with SSL/TLS ' oSmtp.ConnectType = ConnectSSLAuto ' oSmtp.ServerPort = 587 oSmtp.FromAddr = "test@emailarchitect.net" oSmtp.AddRecipient "Support Team", "support@adminsystem.com", 0 oSmtp.Subject = "Test" oSmtp.BodyText = "Hello, this is a test...." If oSmtp.SendMail() = 0 Then MsgBox "Message delivered!" Else MsgBox oSmtp.GetLastErrDescription() End If End Sub
[ASP Classic, VBScript - Send Email] Const ConnectNormal = 0 Const ConnectSSLAuto = 1 Const ConnectSTARTTLS = 2 Const ConnectDirectSSL = 3 Const ConnectTryTLS = 4 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 oSmtp.ServerAddr = "smtp.emailarchitect.net" ' If you don't have SMTP server, use the following codes to send email via DNS lookup ' It is not recommended, most email providers would reject the email for anti-spam policy ' oSmtp.ServerAddr = "" ' User and password for ESMTP authentication ' If your server doesn't require user authentication, please remove the following codes oSmtp.UserName = "test@emailarchitect.net" oSmtp.Password = "test" ' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically oSmtp.ConnectType = ConnectTryTLS ' If your server uses 587 port ' oSmtp.ServerPort = 587 ' If your server uses 465 port with SSL/TLS ' oSmtp.ConnectType = ConnectSSLAuto ' oSmtp.ServerPort = 465 ' If your server uses 25/587 port with SSL/TLS ' oSmtp.ConnectType = ConnectSSLAuto ' oSmtp.ServerPort = 587 oSmtp.FromAddr = "test@emailarchitect.net" oSmtp.AddRecipient "Support Team", "support@adminsystem.com", 0 oSmtp.Subject = "Test email sent from ASP, VBScript" oSmtp.BodyText = "Hello, this is a test...." If oSmtp.SendMail() = 0 Then Response.Write "Message delivered!" Else Response.Write oSmtp.GetLastErrDescription() End If
[JScript/WSH - Send Email] var ConnectNormal = 0; var ConnectSSLAuto = 1; var ConnectSTARTTLS = 2; var ConnectDirectSSL = 3; var ConnectTryTLS = 4; function SendEmail() { var oSmtp = new ActiveXObject("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 oSmtp.ServerAddr = "smtp.emailarchitect.net"; // User and password for ESMTP authentication // If your server doesn't require user authentication, please remove the following codes oSmtp.UserName = "test@emailarchitect.net"; oSmtp.Password = "test"; // ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically oSmtp.ConnectType = ConnectTryTLS; // If your server uses 587 port // oSmtp.ServerPort = 587; // If your server uses 465 port with SSL/TLS // oSmtp.ConnectType = ConnectSSLAuto; // oSmtp.ServerPort = 465; // If your server uses 25/587 port with SSL/TLS // oSmtp.ConnectType = ConnectSSLAuto; // oSmtp.ServerPort = 587; oSmtp.FromAddr = "test@emailarchitect.net"; oSmtp.AddRecipient("Support Team", "support@adminsystem.com", 0); oSmtp.Subject = "Test email sent from ASP, VBScript"; oSmtp.BodyText = "Hello, this is a test ...."; if(oSmtp.SendMail() == 0) WScript.Echo("Message delivered!"); else WScript.Echo(oSmtp.GetLastErrDescription()); }
[Visual C++ - Send Email] #include "stdafx.h" #include <tchar.h> #include <Windows.h> #include "EASendMailObj.tlh" using namespace EASendMailObjLib; const int ConnectNormal = 0; const int ConnectSSLAuto = 1; const int ConnectSTARTTLS = 2; const int ConnectDirectSSL = 3; const int ConnectTryTLS = 4; void SendEmail() { ::CoInitialize(NULL); IMailPtr oSmtp = NULL; oSmtp.CreateInstance(__uuidof(EASendMailObjLib::Mail)); // for evaluation usage, please use "TryIt" as the license code. oSmtp->LicenseCode = _T("TryIt"); // Your SMTP server address oSmtp->ServerAddr = _T("smtp.emailarchitect.net"); // User and password for ESMTP authentication // If your server doesn't require user authentication, please remove the following codes oSmtp->UserName = _T("test@emailarchitect.net"); oSmtp->Password = _T("test"); // ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically oSmtp->ConnectType = ConnectTryTLS; // If your server uses 587 port // oSmtp->ServerPort = 587; // If your server uses 465 port with SSL/TLS // oSmtp->ConnectType = ConnectSSLAuto; // oSmtp->ServerPort = 465; // If your server uses 25/587 port with SSL/TLS // oSmtp->ConnectType = ConnectSSLAuto; // oSmtp->ServerPort = 587; oSmtp->FromAddr = _T("test@emailarchitect.net"); oSmtp->AddRecipient(_T("Support Team"), _T("support@adminsystem.com"), 0); oSmtp->Subject = _T("Test"); oSmtp->BodyText = _T("Hello, this is a test email from VC++ ...."); if (oSmtp->SendMail() == 0) _tprintf(_T("Message delivered!")); else _tprintf((const TCHAR*)oSmtp->GetLastErrDescription()); }
[Delphi - Send Email] unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, EASendMailObjLib_TLB; // add EASendMail unit type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; const ConnectNormal = 0; ConnectSSLAuto = 1; ConnectSTARTTLS = 2; ConnectDirectSSL = 3; ConnectTryTLS = 4; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var oSmtp : TMail; begin oSmtp := TMail.Create(Application); oSmtp.LicenseCode := 'TryIt'; // Your SMTP server address oSmtp.ServerAddr := 'smtp.emailarchitect.net'; // User and password for ESMTP authentication, // If your server doesn't require user authentication, please remove the following codes oSmtp.UserName := 'test@emailarchitect.net'; oSmtp.Password := 'testpassword'; // ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically oSmtp.ConnectType := ConnectTryTLS; // If your server uses 587 port // oSmtp.ServerPort := 587; // If your server uses 465 port with SSL/TLS // oSmtp.ConnectType := ConnectSSLAuto; // oSmtp.ServerPort := 465; // If your server uses 25/587 port with SSL/TLS // oSmtp.ConnectType := ConnectSSLAuto; // oSmtp.ServerPort := 587; // Set your sender email address oSmtp.FromAddr := 'test@emailarchitect.net'; // Add recipient email address oSmtp.AddRecipientEx('support@emailarchitect.net', 0); // Set email subject oSmtp.Subject := 'simple email from Delphi project'; // Set email body oSmtp.BodyText := 'this is a test email sent from Delphi project, do not reply'; ShowMessage('start to send email ...'); if oSmtp.SendMail() = 0 then ShowMessage('email was sent successfully!') else ShowMessage('failed to send email with the following error: ' + oSmtp.GetLastErrDescription()); end; end.
See Also
Using EASendMail ActiveX Object
Registration-free COM with Manifest
User Authentication and SSL Connection
From, ReplyTo, Sender and Return-Path
Digital Signature and Email Encryption - S/MIME
DomainKeys Signature and DKIM Signature
Send Email without SMTP server(DNS lookup)
Work with EASendMail Service(Mail Queuing)
Programming with Asynchronous Mode
Programming with FastSender
Mail vs. FastSender
Bulk Email Sender Guidelines
Process Bounced Email (Non-Delivery Report) and Email
Tracking
Work with RTF and Word
EASendMail ActiveX Object References
EASendMail SMTP Component Samples
Online Tutorials
Send Email
in VB 6.0 - Tutorial
Send
Email in C# - Tutorial
Send
Email in VB.NET - Tutorial
Send Email
in Visual C++ - Tutorial
Send Email in Managed C++/CLI - Tutorial
Send
Email in Delphi - Tutorial
Send
Email in MS SQL stored procedure - Tutorial