Forum

phpMailer problems.
 
Notifications
Retirer tout

phpMailer problems.

11 Posts
3 Utilisateurs
0 Reactions
16.6 {numéro}K Vu
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 
[#2480]

Hi,

I am slowly getting deeper into trouble with the SMTP Mailer function (The IMAP receive mail works fine - at least is connecting to a valid mailbox and checking it).

The Authentication is not working - I have tried all three methods suggested in the on-line manual - so please, no RTFM response 🙂

php mail is not suitable, as my mailserver will ONLY accept mail on "Submission", i.e. port 587.
Socket setting causes other problems earlier in the mail connection process, i.e, not setting up the socket.
This leaves me with phpMailer.

The logs show the following for the connection: (EDIT: This log is for "SOCKETS", not phpMailer.......)

2015-08-02 13:49:18.165 ** ERROR ** ERROR **
2015-08-02 13:49:18.165
** ERROR ** on file '/var/www/html/projeqtor/tool/projeqtor.php' at line (1107)
2015-08-02 13:49:18.169
** ERROR ** cause = fsockopen(): SSL operation failed with code 1. OpenSSL Error messages:
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
2015-08-02 13:49:18.170
** ERROR ** ERROR **
2015-08-02 13:49:18.170 ** ERROR ** on file '/var/www/html/projeqtor/tool/projeqtor.php' at line (1107)
2015-08-02 13:49:18.170 ** ERROR ** cause = fsockopen(): Failed to enable crypto
2015-08-02 13:49:18.173 ** ERROR ** ERROR **
2015-08-02 13:49:18.173
** ERROR ** on file '/var/www/html/projeqtor/tool/projeqtor.php' at line (1107)
2015-08-02 13:49:18.173
** ERROR ** cause = fsockopen(): unable to connect to ssl://mail.verncon.net:587 (Unknown error)
2015-08-02 13:49:18.173
** ERROR ** Error sending mail
2015-08-02 13:49:18.173
** ERROR ** SMTP Server : ssl://mail.verncon.net
2015-08-02 13:49:18.173
** ERROR ** SMTP Port : 587
2015-08-02 13:49:18.173
** ERROR ** SMTP User : project_admin@verncon.net
2015-08-02 13:49:18.173
** ERROR ***** Mail stored in Database : #29

The SSL settings on the server (Apache 2.4) do not allow SSL2 or SSL3 to be used, only TLS - what can be done to ensure that the encryption is only using TLS, not SSL2 or SSL3 as it appears to be doing?

As seen in the attachment, the server name is NOT ssl://mail.verncon.net:587, but mail.verncon.net:587.
The mailserver cannot be changed to add ssl:// as that will break several other functions.

Can the code be changed to remove the automatic addition of "ssl://" to the mailserver string?

Cheers,
VERNCon.


 
Posté : 02/08/2015 4:12 pm
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 

Hi,

OK, making some progress - it appears to be that php5.6 has introduced Client Authentication, so will need to change the settings in the http ssl.conf to set up these checks. Shall report back later with what has been needed, or at least when I progress to the next step.....

Cheers,
VERNCon.


 
Posté : 02/08/2015 4:47 pm
(@babynus)
Posts: 14952
Membre Admin
 

Ssl is not mandatory, just default if authentication is set and no protocolecspecified.
To specify other protocole, just enter it before host name :
tls://hostname
Sorry, but this is explained in the user manual.
RTFM 👿


 
Posté : 02/08/2015 5:38 pm
(@babynus)
Posts: 14952
Membre Admin
 

😉


 
Posté : 02/08/2015 5:39 pm
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 

Yes,

Tried that - my mail-server & dovecot (which does the SASL authentication for my mail-server) "spit's the dummy" with anything put in front.

Cheers,
VERNCon.


 
Posté : 02/08/2015 6:04 pm
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 

Sorry, no cigar for you this time.

The error that I am getting is as shown below:

2015-08-02 16:10:15.114 ** ERROR ** ERROR **
2015-08-02 16:10:15.119
** ERROR ** on file '/var/www/html/projeqtor/external/PHPMailer/class.smtp.php' at line (274)
2015-08-02 16:10:15.119
** ERROR ** cause = stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
2015-08-02 16:10:15.124
** ERROR ** Error sending mail
2015-08-02 16:10:15.124
** ERROR ** SMTP Server : mail.verncon.net
2015-08-02 16:10:15.124
** ERROR ** SMTP Port : 587
2015-08-02 16:10:15.124
** ERROR ** Mail stored in Database : #32
2015-08-02 16:10:15.124
** ERROR ** PHPMail error : SMTP connect() failed.
2015-08-02 16:10:15.124
** ERROR ***** PHPMail debug :

This is a problem which prevents the use of the use of SSL/TLS authenticated mail with php5.6 and above.

PHP5.6 now REQUIRES the supply of a client certificate, with a verifiable CA, from trhe client (i.e. from projeqtor), to allow the authentication process to be passed.

From the GitHub troubleshooting guide https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
.......................

"PHP 5.6 certificate verification failure

In a change from earlier versions, PHP 5.6 verifies certificates on SSL connections. If the SSL config of the server you are connecting to is not correct, you will get an error like this:

Warning: stream_socket_enable_crypto(): SSL operation failed with code 1.
OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

The correct fix for this is to replace the invalid, misconfigured or self-signed certificate with a good one. Failing that, you can allow insecure connections via the SMTPOptions property introduced in PHPMailer 5.2.10 (it's possible to do this by subclassing the SMTP class in earlier versions), though this is not recommended:

$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);"
...............

There is a workaround to it, but is not possible as it is only supported in a feature PHPOptions, which was introduced in phpMailer version 5.2.10, HOWEVER, the version of phpMailer which is supplied with projeqtor5.0.3 is an older version, 5.2.7

How soon can a fix/workaround to this problem be provided?

  • It would be preferable to have a patch to the code which allows for a client certificate and private key to be referenced,

or

  • otherwise an upgraded version of phpMailer, v5.2.10 or above which allows for the setting of an insecure connection to the smtp server.

Cheers,
VERNCon.


 
Posté : 02/08/2015 6:43 pm
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 

Hi,

II am able to send mails out using port 25, but I need to have "milters" and other "essential" security devices disabled for testing this, so it cannot remain using un-authenticated mail submission past midnight Sunday - I need to restore the disabled security checks by then.

I will try and figure out how to hack things to make a valid client certificate and private key "available" to meet the SSLVerify requirement for php5.6.x (I have valid certificate/key pair & CA sub.class1 certs available for this purpose).

I am not a programmer, and know nothing about php, etc, so I seek your help in trying to get a functional solution.

Cheers,
VERNCon.


 
Posté : 02/08/2015 7:47 pm
(@babynus)
Posts: 14952
Membre Admin
 

Hi,

Thanks for your analysis :

It would be preferable to have a patch to the code which allows for a client certificate and private key to be referenced

Request recorded as Ticket #1770

otherwise an upgraded version of phpMailer, v5.2.10 or above which allows for the setting of an insecure connection to the smtp server.

Will try to do this for patch V5.0.4
Ticket #1771 recorded


 
Posté : 03/08/2015 9:17 pm
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 

Still not working yet - I have got through the encryption failures - for some reason I cannot figure out, the CA certificate has was failing - it "looked" correct in the soft-link, but it was not working. Once the soft-links were re-hashed and remade, it passed through that phase.

Now it is being blocked when it starts the authentication through Dovecot/PGSQL. PHPMailer appears to send a null PID in the authentication request, and Dovecot drops it.
When I send a mail through the same interface from Thunderbird (not through PHPMailer, but Dovecot/PGSQL), everything works perfectly.

Will try to get more information tomorrow - currently tied up with a DNS upgrade due to BIND and a "critical" defect notice...... :whistle:


 
Posté : 06/08/2015 12:53 am
(@verncon)
Posts: 41
Trusted Member
Début du sujet
 

Hi, a quick note to say

FIXED!!!

Once I installed 5.0.4, (with the updated PHPMailer 5.2.10) that cleared the final problems.:-)


 
Posté : 06/08/2015 3:42 pm
(@ericzen)
Posts: 24
Eminent Member
 

Hi, a quick note to say

FIXED!!!

Once I installed 5.0.4, (with the updated PHPMailer 5.2.10) that cleared the final problems.:-)

Hello, I've the same problem on my server. What have you done for fixed this problem ?
I've a postfix with dovecot and TLS. When i try to send a mail, i've a problem of authentification. As my webmail server i search how fixed with
$config['smtp_conn_options'] = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
),
);

But i don't find where add this code.
So can you explain how you solved ?

EricZEn


 
Posté : 17/12/2015 6:43 pm
Share:
Retour en haut