Resolving email sending issues with the sc_mail_send macro on Linux or Mac.

Resolving email sending issues with the sc_mail_send macro on Linux or Mac.

If, when using the sc_mail_send macro in a Linux or MAC environment, the following error occurs:

Fatal error: Uncaught Swift_TransportException: Connection could not be established with host smtp.gmail.com [ #0] in /opt/Scriptcase/v9-php81/wwwroot/scriptcase/prod/third/swift/classes/Swift/Transport/StreamBuffer.php:269 Stack trace: #0 /opt/Scriptcase/v9-php81/wwwroot/scriptcase/prod/third/swift/classes/Swift/Transport/StreamBuffer.php(62): Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /opt/Scriptcase/v9-php81/wwwroot/scriptcase/prod/third/swift/classes/Swift/Transport/AbstractSmtpTransport.php(113): Swift_Transport_StreamBuffer->initialize(Array) #2 /opt/Scriptcase/v9-php81/wwwroot/scriptcase/prod/third/swift/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start() #3 /opt/Scriptcase/v9-php81/wwwroot/scriptcase/app/teste_mantis/blank/index.php(2425): Swift_Mailer->send(Object(Swift_Message), Array) #4 /opt/Scriptcase/v9-php81/wwwroot/scriptcase/app/teste_mantis/blank/index.php(2793): blank_apl->controle() #5 {main} thrown in /opt/Scriptcase/v9-php81/wwwroot/scriptcase/prod/third/swift/classes/Swift/Transport/StreamBuffer.php on line 269

It will be necessary to follow the steps below to correct the error:

1º - Locate the php.ini file that is in the root directory: 

- Linux : /opt/Scriptcase/v9-php81/components/php
- MAC : /Applications/Scriptcase/v9-php81/components/php/



2º - After locating the php.ini file, access it.

- Afterward, perform a search for lines 1932 and 1940 and insert the following values:

LINUX
in the line 1932 : curl.cainfo = "/opt/Scriptcase/v9-php81/components/php/etc/curl-ca-bundle.crt" 
in the line 1940 : openssl.cafile="/opt/Scriptcase/v9-php81/components/php/etc/curl-ca-bundle.crt"

MAC
in the line 1932 : curl.cainfo = "/Applications/Scriptcase/v9-php81/components/php/etc/curl-ca-bundle.crt"
in the line 1940 : openssl.cafile = "/Applications/Scriptcase/v9-php81/components/php/etc/curl-ca-bundle.crt"

As shown in the image below



3º - After making changes to the php.ini file, save the changes and restart the Apache service for Scriptcase.


LINUX

/opt/Scriptcase/v9-php81/components/apache/sc_apache restart


Mac

/Applications/Scriptcase/v9-php81/components/apache/sc_apache restart




After restarting, attempt to send the email again in the application using the sc_send_mail macro. This time, the email will be sent without errors.


    • Related Articles

    • Install ScriptCase PHP 7.0 on a XAMPP on Linux

      Xampp Installation Using PHP 7.0 XAMPP It allows you to easily install Apache on your own computer, regardless of your operating system (Linux, Windows, MAC or Solaris). First you have to proceed to download XAMPP PHP ...
    • Install ScriptCase PHP 7.3 on a XAMPP in Linux

      Xampp Installation Using PHP 7.3 XAMPP It allows you to easily install Apache on your own computer, regardless of your operating system (Linux, Windows, MAC or Solaris). First you have to proceed to download XAMPP PHP ...
    • Email Export in Charts

      In Chart applications you can configure the export by email feature. This feature is used to export the Charts and send the export directly by e-mail to the configured recipients. The e-mail export settings can be viewed in the Email Export menu. ...
    • Email Export in Grid

      In the Query applications, you can configure the email export. This feature is used to export the Grid and send the export directly by e-mail to the configured recipients. E-mail export settings can be visualized in the Email export menu. Next, you ...
    • Using the sc_field_display macro

      To dynamically hide a field in this example, the macro sc_field_display is used, which is responsible for hiding or dynamically displaying a field or several. This macro has scope in the following events: In this example, it will be used within an ...