This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v18.4
SMTP_transporter.checkConnection( )

SMTP_transporter.checkConnection( ) 


 

SMTP_transporter.checkConnection () -> Result 
Parameter Type   Description
Result  Object in Status of the transporter object connection

The SMTP_transporter.checkConnection( ) method checks the SMTP connection using information stored in the transporter object and returns the SMTP status. This method allows you to verify that the values provided by the user are valid and consistent.

 

Returned object

The method sends a request to the SMTP server and returns an object describing the SMTP status. This object can contain the following properties:

Property   Type Description
success   Boolean True if the check is successful, False otherwise
status   Number Status code returned by the SMTP server (0 in case of an issue unrelated to the SMTP processing)
statusText   Text Status message returned by the SMTP server, or last error returned in the 4D error stack
errors   Collection 4D error stack (not returned if a SMTP server response is received)
  [ ].errCode Number 4D error code
  [ ].message Text Description of the 4D error
  [ ].componentSignature Text Signature of the internal component which returned the error

Note: For information about SMTP status codes, please refer to this page.

Example  

 C_TEXT($pw)
 C_OBJECT($options)
 $options:=New object
 
 $pw:=Request("Please enter your password:")
 $options.host:="smtp.gmail.com"
 
 $options.user:="test@gmail.com"
 $options.password:=$pw
 
 $transporter:=SMTP New transporter($options)
 
 $status:=$transporter.checkConnection()
 If($status.success=True)
    ALERT("SMTP connection check successful!")
 Else
    ALERT("Error # "+String($status.status)+", "+$status.statusText)
 End if



See also 

SMTP New transporter
SMTP_transporter.send( )

 
PROPERTIES 

Product: 4D
Theme: Mail

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R4

 
ARTICLE USAGE

4D Language Reference ( 4D v18)
4D Language Reference ( 4D v18.4)
4D Language Reference ( 4D v18.6)