A small contribution: Add an option to have ability to use Self-Signed Certificate on a given SMTP server with WireMailSmtp and PHP >= 5.6 What PHP say - source : https://secure.php.net/manual/en/migration56.openssl.php
HOWTO: ----------- 1) In file smtp.php, class smtp_class, we add a member variable and a small function :
/* Allow self signed certificate */
var $smtp_certificate = false;
Function AllowSelfSignedCertificate($allow = false)
{
$version=explode(".",function_exists("phpversion") ? phpversion() : "3.0.7");
$php_version=intval($version[0])*1000000+intval($version[1])*1000+intval($version[2]);
if($php_version<5006000)
return;
if($allow) {
stream_context_set_option($this->connection, 'ssl', 'verify_peer', false);
stream_context_set_option($this->connection, 'ssl', 'allow_self_signed', true);
}
else
{
stream_context_set_option($this->connection, 'ssl', 'verify_peer', true);
stream_context_set_option($this->connection, 'ssl', 'allow_self_signed', false);
}
}
and, in the Connect() method, call the function just in before we check for the result of stream_socket_enable_crypto : Find :
$this->OutputDebug('Starting TLS cryptograpic protocol');
if(!($success = stream_socket_enable_crypto($this->connection, 1, STREAM_CRYPTO_METHOD_TLS_CLIENT)))
Replace to
$this->OutputDebug('Starting TLS cryptograpic protocol');
$this->AllowSelfSignedCertificate($this->smtp_certificate);
if(!($success = stream_socket_enable_crypto($this->connection, 1, STREAM_CRYPTO_METHOD_TLS_CLIENT))
2) In the file smtp_message.php, class smtp_message_class, add a member variable :
/* Allow Self Signed Certificate */
var $smtp_certificate = 0;
In the method StartSendingMessage() , assign the new member variable:
$this->smtp->smtp_certificate = $this->smtp_certificate;
3) In the file WireMailSmtpAdaptator, class hnsmtp, add a member variable :
private $smtp_certificate = false;
and in the method set_var_val(), add a case smtp_certificate for our checkbox : Find :
case 'smtp_ssl':
case 'smtp_start_tls':
case 'smtp_debug':
case 'smtp_html_debug':
Replace :
case 'smtp_certificate':
case 'smtp_ssl':
case 'smtp_start_tls':
case 'smtp_debug':
case 'smtp_html_debug':
In the class constructor, add :
$this->emailMessage->smtp_certificate = $this->smtp_certificate;
4) In the WireMailSmtpConfig.php file, add a field : add :
$field = $modules->get('InputfieldCheckbox');
$field->attr('name', 'smtp_certificate');
$field->label = __('PHP >= 5.6 - Allow self signed certificate');
$field->attr('value', $data['smtp_certificate']);
$field->attr('checked', $data['smtp_certificate'] ? 'checked' : '');
$fieldset->add($field);
5) In the WireMailSmtp.module file, add a settings to the getDefaultdata() : Find :
'valid_recipients' => '' // email addresses of valid recipients. String that we convert to array at runtime.
Add after (take care of comma ','):
'smtp_certificate' => 0 // allow or not self signed certificate (PHP >= 5.6)
Result :
Hope it help. Sorry for my english