I have copied the entire PEAR folder that osTicket uses to a new folder called "pearmail" on my server and created a test PHP script based on this tutorial and named it test-pear-mail.php
.
When I execute test-pear-mail.php
from the CLI, it always gives the following error (regardless of whether I set the port number to 465 or 587.
myusername@ssh:/var/www/myusername/html/pearmail$ php test-pear-mail.php
Warning: stream_socket_client(): unable to connect to XXX.XXX.XXX,XXX:587 (Connection timed out) in /var/www/myusername/html/pearmail/Net/Socket.php on line 166
<p>Failed to connect to servername.domainname.tld:587 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]</p>myusername@ssh:/var/www/
When I execute test-pear-mail.php
from a browser/URL, it becomes unresponsive when the port number 465 is used, but when port number 587 is set, the test email is sent and received correctly. UPDATE: If I wait long enough, I get an error message in the browser. See my next message below.
The error code being thrown by Socket.php
in the CLI, by the way, is identical to the error message seen in osTicket when I try to save an email with SMTP port number 465 set: (code: -1, response: )