SMTP connection email fail: adding new user using security module

I can?t get the email facility built into the security module applications to work. I have tried two sets of email login details for different servers. I have used telnet to see if the email server responds (it does) and openssl to connect to SMPT and see the certificate (that works). But when I try it with my PHP script in app_form_add_users and app_form_edit_users I get this when I try to add a new user:
stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
stream_socket_client(): Failed to enable crypto
stream_socket_client(): unable to connect to ssl:// (Unknown error)

Fatal error: Uncaught exception ‘Swift_TransportException’ with message ‘Connection could not be established with host [ #0]’ in /home/bidbaseadmin/public_html/bidbase/_lib/prod/third/swift/classes/Swift/Transport/StreamBuffer.php:269 Stack trace: #0 /home/bidbaseadmin/public_html/bidbase/_lib/prod/third/swift/classes/Swift/Transport/StreamBuffer.php(62): Swift_Transport_StreamBuffer->_establishSocketConnection() #1 /home/bidbaseadmin/public_html/bidbase/_lib/prod/third/swift/classes/Swift/Transport/AbstractSmtpTransport.php(113): Swift_Transport_StreamBuffer->initialize(Array) #2 /home/bidbaseadmin/public_html/bidbase/_lib/prod/third/swift/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start() #3 /home/bidbaseadmin/public_html/bidbase/app_form_edit_users/app_form_edit_users_apl.php(3836): Swift_Mailer->send(Object(Swift_Message), Array) #4 /home/bidbaseadmin/public_html/bidbase/app_form_edit_users/app_form_edit_users_apl.php(3401): app_form_edit_users_apl->send_mail_to_admin() #5 /h in /home/bidbaseadmin/public_html/bidbase/_lib/prod/third/swift/classes/Swift/Transport/StreamBuffer.php on line 269

I get this whether I?m in the development environment or the production environment. It is most frustrating; I have been trying for over a week to fix it. My code is:


  • Send a simple email

// Email parameters
$mail_smtp_server = ‘’; // SMTP server name or IP address
$mail_smtp_user = ‘’; // SMTP user name
$mail_smtp_pass = ?**********?; // SMTP password
$mail_from = ‘’; // From email
$mail_to = $emails_admin; // To email

$mail_message = sprintf({lang_new_user_sign_in}, {name}, {email}, {email});

$mail_subject = {lang_subject_mail_new_user};
$mail_format = ‘H’; // Message format: (T)ext or (H)tml
$mail_port = ‘587’; //Port setting
$mail_ssl = ‘S’; //SSL is on

// Send email
sc_log_add(“New user”, {lang_send_mail_admin});

I would appreciate any help on this. I have been reading up on SMTP and email server issues, as well as issues with Mailer, but nothing works. I have checked the SSL certificate on and it responds fine (though it is self-signed).


These messages occur when you use a different port and try to connect encrypted. Are you sue that port 587 is ssl encrypted?
You could have your ssl.conf wrong (wrong path in ssl.conf for example).

Scriptcase has a bug. Use the below

$mail_port = ‘25’; //Port setting
$mail_ssl = ‘N’; //Non secure

It does not work with SSL

Thanks so much for taking the trouble to respond on this. We eventually gave up trying to fix it and have been manually adding/editing users via phpMyAdmin since 2016! Thankfully we don’t have a massive user base. But I will keep in mind your fix for future use. I may even fix it! :laughing: Mike