Skip to main content
Version: 4.2.5

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

NameDescription
StateThe state of the SMTP Object
TimeoutTimeout in milliseconds.
ObjectIsEmptyReturns 1 if object is not created.
LastReturnCodeReturns last known return code from object.
note

Properties ObjectIsEmpty and LastReturnCode are common methods. For more information see Common properties and methods.

Methods

NameDescription
SetDeliveryStatNotSets a delivery status notification.
LoginEstablish a session.
LogoutEnds a session.
SendSends a message.
QuickSendBuilds and sends a message in one step.
CreateObjectCreates a new instance of the object.
FreeObjectReleases 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

NotifyType: MailDsnConstants

Default: MailDsn_Failure
Description: Type of notification requested.
SegmentType: MailSegmentConstant

Default: MailSegm_Header
Description: Type of segment to return.
EnvelopeIdType: 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

ServerType: String

Description: Can be either:
  • a host name (example: server.com)
  • an IP address (example: 192.168.0.0)
  • An auto configuration (example: auto:MicrosoftOffice365)

For more information, see Well-known mail servers.

PortType: Integer

Default: 25

Description: Specifies the port number. Defaults to the "well-known" port 25.
UsernameType: String

Default: '

Description: Specifies the server account to access.
PasswordType: ParamTypePassword

Default: '

Description: Specifies the password for the server account.
SASLMechanismType: SASLMechanism

Default: '

Description: Specifies the SASL mechanism to use for authentication during login. Possible values are:
  • DIGEST-MD5
  • CRAM-MD5
  • NTLM
If no SASL mechanism is set, authentication using PLAIN or LOGIN will be attempted.
StartTlsOptionType: MailStartTlsOptions

Default: Retry

Description: Specifies how Start TLS will be used.
Possible values are:
  • Never
  • Always
  • Retry
SSLVersionsType: 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.
ReturnValueType: ParamTypeBool

Description: Returns True_Value (1) on success.

See Also

SMTP Object::Logout


Logout

Ends a session.

Parameters

---

See Also

SMTP Object::Login


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

MessageType: Mail Message Object

Description: The message to send.
ReturnValueType: ParamTypeBool

Description: Returns True_Value (1) on success.

See Also

SMTP Object::QuickSend


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

ToType: String

Description: Contains one or more recipient addresses separated by semi-colon.
FromType: String

Description: Contains the e-mail address of the message originator.
SubjectType: String

Default: "

Description: Specifies the Subject of the message.
TextType: String

Default: "

Description: Contains the message text.
AttachmentsType: String

Default: "

Description: Contains one or more attachment files (separated by semicolons) to be sent with the message.
ReturnValueType: 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.

See Also

SMTP Object::Send