SMTP Mailer Module: SMTP Error: Could not connect

I'm having problems sending emails through the app. I activated the SMTP Mailer module and am using Gmail as my mail server. Here are my settings:

  • Enable SMTP Mailer: true
  • SMTP Authentication: true
  • SMTP Username: myname@mydomain.com
  • SMTP Password: mypassword
  • SMTP Server Name: smtp.gmail.com
  • SMTP Server Port: 587
  • Secure Connection: TLS (incorrectly labeled as "TSL" in the app)
  • 'From' Name: My Site Name
  • Override Default Sender: myname@mydomain.com
  • Attach: false

====

The error message in the Test Form: "Mail Send Failed"

The error message in any form on the site: "SMTP Error: Could not connect to SMTP host."

====

My server:

  • Ubuntu Server 14.04.1 LTS 
  • Passed all requirements during installation
  • I have other PHP sites on the server successfully sending Emails through smtp.gmail.com

Logs

====

Apache error.log after clicking the 'Save' or 'Test' button in the SMTP Mailer form:

[Thu Jul 02 16:59:00 2015] [warn] [client 135.0.6.44] mod_fcgid: stderr: PHP Warning:  curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when safe_mode is enabled or an open_basedir is set in /var/www/clients/client14/web67/web/inc/utils.inc.php on line 1160, referer: http://mydomain.com/m/smtpmailer/administration/

PHP Info:

safe_mode Off Off
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
open_basedir /a/bunch/of/paths /a/bunch/of/paths

Please help.

Quote · 2 Jul 2015

Have you tried setting, in your php.ini file,

open_basedir = none

Look for 'Loaded configuration File' in php info for location of php.ini  You can view this in Dolphin Admin > Tools > Host Tools > PHP Info

Then restart apache

My opinions expressed on this site, in no way represent those of Boonex or Boonex employees.
Quote · 2 Jul 2015

Guys,

I found the bugs.

  1. The install script has a typo in the connection type drop down in the Administration panel. 
  2. The phpmailer plugin does not convert the connection type value to lower case.
  3. The SMTP Mailer module always assigns an SSL connection no matter what value was selected.

Here's how I fixed it.

1. In /modules/boonex/smtpmailer/install/sql/install.sql: change 'TSL' to 'TLS'.

2. Update the database by changing 'TSL' to 'TLS' using this script:

UPDATE  `sys_options` SET  `VALUE` =  'TLS', `AvailableValues` =  'Not Secure,SSL,TLS' WHERE  `sys_options`.`Name` =  'bx_smtp_secure'; 

3. In /modules/boonex/smtpmailer/classes/BxSMTPModule.php: change

$mail->SMTPSecure = "ssl";
to...
$mail->SMTPSecure = $sParamSecure;

4. In /plugins/phpmailer/class.phpmailer.php: change

        $tls = ($this->SMTPSecure == 'tls');
        $ssl = ($this->SMTPSecure == 'ssl');

to...

        $tls = ($this->SMTPSecure == 'TLS');
        $ssl = ($this->SMTPSecure == 'SSL');

It works like a charm now. Can't say if this will work for non-secure connections though.

Quote · 2 Jul 2015

 

Have you tried setting, in your php.ini file,

open_basedir = none

Look for 'Loaded configuration File' in php info for location of php.ini  You can view this in Dolphin Admin > Tools > Host Tools > PHP Info

Then restart apache

 Thanks for the suggestion, but I am running many websites on my server, as well as providing SSH access so I cannot set that value to none for security reasons.

Quote · 2 Jul 2015

 

Thanks for the suggestion, but I am running many websites on my server, as well as providing SSH access so I cannot set that value to none for security reasons.

Then you're not going to be able to use Dolphin. You should at least be able to make the changes for your own sites.

BoonEx Certified Host: Zarconia.net - Fully Supported Shared and Dedicated for Dolphin
Quote · 3 Jul 2015

 

 

Thanks for the suggestion, but I am running many websites on my server, as well as providing SSH access so I cannot set that value to none for security reasons.

Then you're not going to be able to use Dolphin. You should at least be able to make the changes for your own sites.

 I was able to fix it by correcting the typos in the script. But I can undo it and set the open_basedir on a per-directory basis via apache config to see if it will work.

Quote · 3 Jul 2015

Thank you for the report:

http://www.boonex.com/trac/dolphin/ticket/3544

Rules → http://www.boonex.com/terms
Quote · 6 Jul 2015
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.