SMTPClient object

SMTPClient allows applications to send email by using the Simple Mail Transfer Protocol (SMTP).

For the latest documentation, please refer to the section called “About SMTP” in Application Techniques. For example scripts on using SMTP for different scenarios, please refer to the section called “Using SMTP” in Application Techniques.

Note

SMTPClient (as well as HTTPClient, CrypterObject, CoderObject, CompressorObject, DotNetAssembly, JSONGenerator, JSONParser, JSONPackage, OAuthClient, PDF Builder objects, RESTClient, PowerServerLabel, PowerServerResult) does not support multi-threading.

Properties

SMTPClient property

Datatype

Description

AuthType

Integer

Specifies the SMTP authentication type to be used by the server.

CheckForServerCertRevocation

Boolean

When the CheckForServerCertRevocation property is enabled, the program checks if the server certificate is revoked when sending a request.

ClassDefinition

PowerObject

An object of PowerObject type containing information about the class definition of the object or control.

EnableTLS

Boolean

Specifies whether the SMTPClient uses Transport Layer Security (TLS) to encrypt the connection.

Host

String

Sets the server domain when connecting to services.

IgnoreServerCertificate

Boolean

When the IgnoreServerCertificate property is set with a value, the program will ignore certain type(s) of server certificate error when sending a request.

Message

MimeMessage

Represents an email message that can be sent using the SmtpClient class.

Password

String

Sets the sender's password when sending an email.

Port

Long

Sets the server port when connecting to services.

SecureProtocol

Integer

Specifies the secure protocol.

Timeout

Integer

Sets a value that specifies the amount of time in seconds before a timeout for a Send call.

UserName

String

Sets the sender's username when sending an email.

XOAuth2AccessToken

String

Sets an XOAuth2 access token.


Events

SMTPClient event

Occurs

OnSendFinished

Occurs when an email is sent by SendAsync. If there is an error from SendAsync, this event gets the error number and error text.

Constructor

When the user object is created.

Destructor

When the user object is destroyed.


Functions

SMTPClient function

Datatype returned

Description

ClassName

String

Returns the name assigned to the user object.

GetContextService

Integer

Creates a reference to a context-specific instance of the specified service.

GetParent

PowerObject

Returns a reference to the name of the parent object.

LogFile

None

Gets operational log information to a file when sending an email.

PostEvent

Boolean

Adds an event to the end of the message queue of the user object.

Send

Integer

Sends an email message to an SMTP server for delivery.

SendAsync

Long

Sends an email message asynchronously.

SendAsyncCancel

Integer

Cancels the email to be sent asynchronously in the mailing list.

SetProxy

Integer

Sets the server proxy of this email message.

TriggerEvent

Integer

Sends an event to the user object and executes the script associated with the event.

TypeOf

Object

Returns the type of the user object.