Skip to main content
Version: 20 R10

IMAP New transporter

History
ReleaseChanges
18 R4Added

IMAP New transporter*( server : Object ) : 4D.IMAPTransporter

ParameterTypeDescription
serverObjectMail server information
Result4D.IMAPTransporterIMAP transporter object

Description

The IMAP New transporter command configures a new IMAP connection according to the server parameter and returns a new transporter object. The returned transporter object will then usually be used to receive emails.

In the server parameter, pass an object containing the following properties:

serverDefault value (if omitted)

False
.accessTokenOAuth2: Text
.accessTokenOAuth2: Object
Text string or token object representing OAuth2 authorization credentials. Used only with OAUTH2 authenticationMode. If accessTokenOAuth2 is used but authenticationMode is omitted, the OAuth 2 protocol is used (if allowed by the server). Not returned in IMAP transporter object.
none

the most secure authentication mode supported by the server is used

300

30

mandatory

none
.password : Text
User password for authentication on the server. Not returned in IMAP transporter object.
none

993

none

Warning: Make sure the defined timeout is lower than the server timeout, otherwise the client timeout will be useless.

Result

The function returns an IMAP transporter object. All returned properties are read-only.

The IMAP connection is automatically closed when the transporter object is destroyed.

Example

$server:=New object
$server.host:="imap.gmail.com" //Mandatory
$server.port:=993
$server.user:="4d@gmail.com"
$server.password:="XXXXXXXX"
$server.logFile:="LogTest.txt" //log to save in the Logs folder

var $transporter : 4D.IMAPTransporter
$transporter:=IMAP New transporter($server)

$status:=$transporter.checkConnection()
If(Not($status.success))
ALERT("An error occurred: "+$status.statusText)
End if

Properties

Command number1723
Thread safe