SMTP Object
Overview
Sends messages with SMTP.
You can use the SMTP Control to send mail to any SMTP server. Supports most popular protocol extensions (ESMTP).
note
If a mail server returns the SMTP error "530 5.7.0 Must issue a STARTTLS command first", the SMTP Object will renegotiate the connection using STARTTLS and retry the send operation if StartTLSOption Retry
was specified in the Login method.
Sections
Init, Main, Procedures, OnExit, and Structure.
note
The object is declared in the Declare section.
Properties
Name | Description |
---|---|
State | The state of the SMTP Object |
Timeout | Timeout in milliseconds. |
ObjectIsEmpty | Returns 1 if object is not created. |
LastReturnCode | Returns last known return code from object. |
note
Properties ObjectIsEmpty
and LastReturnCode
are common methods. For more information see Common properties and methods.
Methods
Name | Description |
SetDeliveryStatNot | Sets a delivery status notification. |
Login | Establish a session. |
Logout | Ends a session. |
Send | Sends a message. |
QuickSend | Builds and sends a message in one step. |
CreateObject | Creates a new instance of the object. |
FreeObject | Releases the instance of the object. |
note
Methods CreateObject
and FreeObject
are common methods. For more information see Common properties and methods.
See Also
POP3 Object
Mail Message Object
Properties
State
State of the SMTP Object.
Type: MailStateConstants
Default: -
Read: get_State
Write: -
See Also
MailStateConstants
StartTLSOptions
SMTP Object::Login
SMTP Object::Logout
Timeout
Timeout in milliseconds.
Type: Integer
Default: -
Read: get_Timeout
Write: put_Timeout
Methods
SetDeliveryStatNot
Defines the type of delivery status notification that will be requested for subsequent messages.
Parameters
Notify | Type: MailDsnConstants Default: MailDsn_Failure Description: Type of notification requested. |
Segment | Type: MailSegmentConstant Default: MailSegm_Header Description: Type of segment to return. |
EnvelopeId | Type: String Default: '' Description: To be included in the return message header. |
See Also
MailDsnConstants
MailSegmentConstant
Login
Establishes a session. Server parameter may be either a host name or an IP address. Returns True_Value (1) on success. Implicit SSL will be used unless StartTLSOption specifies Always
or Retry
(implicit SSL will be used in first handshake attempt though).
Parameters
Server | Type: String Description: Can be either:
For more information, see Well-known mail servers. |
Port | Type: Integer Default: 25 Description: Specifies the port number. Defaults to the "well-known" port 25. |
Username | Type: String Default: ' Description: Specifies the server account to access. |
Password | Type: ParamTypePassword Default: ' Description: Specifies the password for the server account. |
SASLMechanism | Type: SASLMechanism Default: ' Description: Specifies the SASL mechanism to use for authentication during login. Possible values are:
|
StartTlsOption | Type: MailStartTlsOptions Default: Retry Description: Specifies how Start TLS will be used. Possible values are:
|
SSLVersions | Type: SSLVersions Default: TLS 1.3, TLS 1.2 Description: Specifies which SSL/TLS version(s) that may be used. For more information, see General information about SSL and TLS. |
ReturnValue | Type: ParamTypeBool Description: Returns True_Value (1) on success. |
See Also
Logout
Ends a session.
Parameters
---
See Also
Send
Sends a message.
note
If a mail server returns the SMTP error "530 5.7.0 Must issue a STARTTLS command first", the SMTP Object will renegotiate the connection using STARTTLS and retry the send operation if StartTLSOption Retry
was specified in the Login method.
Parameters
Message | Type: Mail Message Object Description: The message to send. |
ReturnValue | Type: ParamTypeBool Description: Returns True_Value (1) on success. |
See Also
QuickSend
Builds and sends a message in one step. If there are more than one To-address or attachment, they must be separated by semi-colon.
note
If a mail server returns the SMTP error "530 5.7.0 Must issue a STARTTLS command first", the SMTP Object will renegotiate the connection using STARTTLS and retry the send operation if StartTLSOption Retry
was specified in the Login method.
Parameters
To | Type: String Description: Contains one or more recipient addresses separated by semi-colon. |
From | Type: String Description: Contains the e-mail address of the message originator. |
Subject | Type: String Default: " Description: Specifies the Subject of the message. |
Text | Type: String Default: " Description: Contains the message text. |
Attachments | Type: String Default: " Description: Contains one or more attachment files (separated by semicolons) to be sent with the message. |
ReturnValue | Type: ParamTypeBool Description: Returns True_Value (1) on success. Note: When compiling a Script, the variable to which ReturnValue is assigned must be initialized to False_Value before the call to QuickSend is made for the correct functionality. This is because the function does not modify the value of the variable assigned to the ReturnValue property in case of a failure. On success, the variable is set to True_Value, and on failure the variable content is left unmodified. |