SendAsync Method

<< Click to Display Table of Contents >>

Navigation:  Reference > SmtpMail >

SendAsync Method

 

SendAsync method sends e-mail message asynchronously.

 

Syntax

 

[Visual Basic]


Function SendAsync(objMessage As AddEmailLib.MailMessage, bUseSmtpServer As Boolean) As Long

 

Example:

 

Dim numMessageNumber As Long

numMessageNumber = objSmtpMail.SendAsync(objMessage, True)

 

[VBScript]


Function SendAsync(objMessage, bUseSmtpServer)

 

Example:

 

Dim numMessageNumber

numMessageNumber = objSmtpMail.SendAsync(objMessage, True)

 

[C#]


int SendAsync(AddEmailLib.MailMessageClass objMessage, bool bUseSmtpServer);

 

Example:

 

int numMessageNumber = objSmtpMail.SendAsync(objMessage, true);

 

[C++]


HRESULT SendAsync(IMailMessage* objMessage, VARIANT_BOOL bUseSmtpServer, LONG* pnumResultCode);

 

Example:

 

int numMessageNumber = spSmtpMail->SendAsync(objMessage, TRUE);

 

 

Parameters

 

objMessage [in]

Prepared MailMessage object containing the e-mail message to send.

 

bUseSmtpServer [in]

Specifies whether the message should be sent using SMTP server. If the parameter is true (not equal to zero), message will be send using SMTP server specified in SmtpServer property. If the parameter is false (equal to zero), message will be send directly to the recipients' mail server(s). This parameter is valid for AddEmail Enterprise version only. AddEmail Professional always uses specified SMTP server.

 

Return value

 

Returns message number which identifies this message. Message number is used to obtain status of the message or cancel the message.

 

Remarks

 

This method is asynchronous: it validates the message, places it to the message queue and returns immediately. Actual sending of the message is done in another thread. SendAsync doesn't block an application and can be safely used in single-threaded applications. The message number returned by this method is used in GetStatus Method, GetErrorCode Method, GetErrorDescription Method, Cancel Method, OnStatusChange Event and OnProgress Event. Please refer to the SenderHostname topic for more information about sending e-mails directly without using SMTP server of your organization or internet provider (Enterprise version only).