AutoTLS is causing issues with SMTP #967

Open
opened 2026-10-05 00:25:58 +02:00 by adam · 0 comments
Owner

Hello,

Fresh install of Piwigo (Docker Image)

Piwigo 2.10.1 Check for upgrade
Operating system: Linux
PHP: 7.3.10 (Show info) [2019-10-27 16:38:52]
MySQL: 5.7.25 [2019-10-27 20:38:52]
Graphics Library: ImageMagick 7.0.8-58

I entered SMTP configuration as follows by updating config file using Local File Editor

$conf['send_bcc_mail_webmaster'] = false;

// define the name of sender mail: if value is empty, gallery title is used
$conf['mail_sender_name'] = 'Jarvis';

// define the email of sender mail: if value is empty, webmaster email is used
$conf['mail_sender_email'] = 'jarvis@vkrm.ch';

// set true to allow text/html emails
$conf['mail_allow_html'] = true;

// smtp configuration (work if fsockopen function is allowed for smtp port)
// smtp_host: smtp server host
//  if null, regular mail function is used
//   format: hoststring[:port]
//   exemple: smtp.pwg.net:21
// smtp_user/smtp_password: user & password for smtp authentication
$conf['smtp_host'] = 'smtp';
$conf['smtp_user'] = '';
$conf['smtp_password'] = '';

// 'ssl' or 'tls'
$conf['smtp_secure'] = null;

SMTP host is valid and has default port 25. No authentication.

This wouldn't trigger any email and I would see the following warning in the GUI

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /config/www/gallery/include/phpmailer/class.smtp.php on line 368

Warning: Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting in /config/www/gallery/include/functions_mail.inc.php on line 910

Looking at the SMTP server logs, found that Piwigo was somehow using TLS even though I had not specified any TLS connection.

Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: connect from piwigo.jarvis_default[172.18.0.10]
Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: SSL_accept error from piwigo.jarvis_default[172.18.0.10]: -1
Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: warning: TLS library problem: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:../ssl/record/rec_layer_s3.c:1407:SSL alert number 48:
Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: lost connection after STARTTLS from piwigo.jarvis_default[172.18.0.10]
Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: disconnect from piwigo.jarvis_default[172.18.0.10] ehlo=1 starttls=0/1 commands=1/2

Further debugging shows that $mail->SMTPAutoTLS is true by default. Setting $mail->SMTPAutoTLS=false in functions_mail.inc.php fixes the issue and email is received.

Hello, Fresh install of Piwigo (Docker Image) ``` Piwigo 2.10.1 Check for upgrade Operating system: Linux PHP: 7.3.10 (Show info) [2019-10-27 16:38:52] MySQL: 5.7.25 [2019-10-27 20:38:52] Graphics Library: ImageMagick 7.0.8-58 ``` I entered SMTP configuration as follows by updating config file using Local File Editor ``` $conf['send_bcc_mail_webmaster'] = false; // define the name of sender mail: if value is empty, gallery title is used $conf['mail_sender_name'] = 'Jarvis'; // define the email of sender mail: if value is empty, webmaster email is used $conf['mail_sender_email'] = 'jarvis@vkrm.ch'; // set true to allow text/html emails $conf['mail_allow_html'] = true; // smtp configuration (work if fsockopen function is allowed for smtp port) // smtp_host: smtp server host // if null, regular mail function is used // format: hoststring[:port] // exemple: smtp.pwg.net:21 // smtp_user/smtp_password: user & password for smtp authentication $conf['smtp_host'] = 'smtp'; $conf['smtp_user'] = ''; $conf['smtp_password'] = ''; // 'ssl' or 'tls' $conf['smtp_secure'] = null; ``` SMTP host is valid and has default port 25. No authentication. This wouldn't trigger any email and I would see the following warning in the GUI ``` Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /config/www/gallery/include/phpmailer/class.smtp.php on line 368 Warning: Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting in /config/www/gallery/include/functions_mail.inc.php on line 910 ``` Looking at the SMTP server logs, found that Piwigo was somehow using TLS even though I had not specified any TLS connection. ``` Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: connect from piwigo.jarvis_default[172.18.0.10] Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: SSL_accept error from piwigo.jarvis_default[172.18.0.10]: -1 Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: warning: TLS library problem: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca:../ssl/record/rec_layer_s3.c:1407:SSL alert number 48: Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: lost connection after STARTTLS from piwigo.jarvis_default[172.18.0.10] Oct 27 19:46:20 e640d02315cb postfix/smtpd[485]: disconnect from piwigo.jarvis_default[172.18.0.10] ehlo=1 starttls=0/1 commands=1/2 ``` Further debugging shows that $mail->SMTPAutoTLS is true by default. Setting $mail->SMTPAutoTLS=false in functions_mail.inc.php fixes the issue and email is received. <!-- github-sync-id:513019624 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#967