Description
Sends an email message asynchronously. This function does not block the calling thread while it transmits the message.
Applies to
Syntax
smtpclient.SendAsync()
Argument |
Description |
---|---|
smtpclient |
A SMTP client object identifying the client in which you want to send an email message asynchronously. |
Return value
Long.
Returns the handle of the inserted item if it succeeds and -1 if an error occurs. If any argument's value is null, returns null.
Examples
The following example sets the email account information and the email message, and then sends the email message asynchronously. Since the function sends the email message asynchronously, and the result is judged in the OnSendFinished event, you should not destroy inv_SmtpClient immediately after executing the function.
Long ll_handle n_smtpclient inv_SmtpClient inv_SmtpClient = CREATE n_smtpclient //set the email account information inv_SmtpClient.Host = "smtp.gmail.com" inv_SmtpClient.Port = 587 inv_SmtpClient.Username = "tester001.appeon@gmail.com" inv_SmtpClient.password = "Mypassword001" inv_SmtpClient.EnableTLS = True //set the email message inv_SmtpClient.Message.SetSender("tester001.appeon@gmail.com","Tester001") inv_SmtpClient.Message.AddRecipient("tester002.appeon@gmail.com") inv_SmtpClient.Message.Subject = "SMTPClient Test Message" inv_SmtpClient.Message.TextBody = "SMTPClient example message body" //send the email message asynchronously ll_handle = inv_SmtpClient.SendAsync() ... DESTROY inv_SmtpClient
See also