User Manual
Version 7.6
×

SMTP

 
The tab allows you to enter additional settings for the SMTP server.
• SMTP Host - SMTP server address.
• SMTP Port - SMTP server port.
• SMTP Login - Email server smtp login.
• SMTP Passw - Email server smtp password.
• SMTP Email - SMTP server email address.
• SMTP Security - selection list.
 
 
Section for Partners only
 
 
 
Checking SMTP server
 
This code uses SMTP (Simple Mail Transfer Protocol) to send emails.
 
Let's break down what it does:
First, it gets the SMTP host from the request and checks if it was specified.
Then it gets the SMTP port from the request. If the port was not specified, the standard SMTP port 25 is used.
 
After that, it includes the SMTP class, creates a new instance of the class, sets the connection timeout and debug level.
Next, it tries to connect to the SMTP server. If it is specified that the connection should be made via SSL, then the 'ssl://' prefix is ​​added to the host. SSL certificate verification is disabled in the connection parameters.
If the connection is successful, an EHLO request is sent (an extended version of HELO, the hello command in the SMTP protocol).
 
Gets a list of ESMTP extensions supported by the server. If the connection must be made via TLS and the server supports STARTTLS, then an attempt is made to start an encrypted connection and send a new EHLO request.
 
If the server supports authentication (which usually happens after a successful connection via TLS), an attempt is made to authenticate using the login and password received from the request.
 
If an exception occurs during the process, then information about the error is written to the error log, HTTP response code 400 is returned, and an error message is displayed in JSON format.
 
After all, regardless of the result, the connection is closed with the QUIT command.
At the end, the function returns an array with connection parameters.