Where are these logs you all mention?

I’ve seen responses in these forums to problems similar to mine:
Event log shows “SMTP connect() failed.”

But I can’t find these logs you all reference. I have a dedicated server with root access (cPanel/WHM), so I can look everywhere: exim_mainlog, error_log, etc. But none of them show anything relevant to the PHPlist failure.

Please note, I’m using a third-party SMTP server: privateemail.com from Namecheap.

TL;DR;

SETTINGS:
PHPlist v 3.4.1
admin/PHPMailer/VERSION file contains “5.2.22”

class.smtp.php
line 125: public $do_debug = self::DEBUG_SERVER;
line 140: public $Debugoutput = ‘error_log’; (tried ‘echo’ and ‘html’ but got blank screens after submitting test.)

CONFIG.PHP
// if you have an SMTP server, set it here. Otherwise it will use the normal php mail() function

define(“PHPMAILER”,1);
define(‘PHPMAILERHOST’, ‘mail.privateemail.com’);
$phpmailer_smtpuser = ‘functioning email.address’;
$phpmailer_smtppassword = ‘valid-password’;
define(‘PHPMAILERPORT’,‘587’);
define(‘PHPMAILER_SECURE’,‘tls’);

/* PLEASE NOTE - THIS SECTION COMMENTED OUT
If the mail server is using a self-signed certificate, then you need to add the following as well:
$phpmailer_smtpoptions = array(
‘ssl’ => array(
‘verify_peer’ => false,
‘verify_peer_name’ => false,
‘allow_self_signed’ => true
)
);
*/

This is the phplist Event Log page under the System menu.

duncanc, I see you reply to many forum members, and glad to have folks like you around.

My problem is that that is the only line in my PHPlist Event Log. Others in this forum (including some of your replies) allude to a much more verbose set of error messages to use for troubleshooting.

c.f. dariuso in this forum exchange… SMTP connect() failed - #6 by duncanc

Is there anywhere else I might look for clues to my problem?

What are the commands I should use (PuTTY) to test my connection to the 3rd-party email service?

@eLIANT You can enable SMTP debug. See the explanation in the config_extended.php file and add a define to config.php.

In config/config.php I have
define(‘PHPMAILER_SMTP_DEBUG’, 1);

and as I noted in opening post, in admin/PHPMailer/class.smtp.php I have
public $do_debug = self::DEBUG_LOWLEVEL;
& public $Debugoutput = ‘error_log’;

…but the only thing in Event Log is “Error sending email to [abc.at.domain.com] SMTP connect() failed.”

USING PuTTY, I got this so far…
telnet mail.privateemail.com 587
Trying 198.54.122.60…
Connected to mail.privateemail.com.
Escape character is ‘^]’.
220 PrivateEmail.com prod Mail Node
ehlo server1.my_dedi_server.com
250-mta-08.privateemail.com
250-PIPELINING
250-SIZE 81788928
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-CHUNKING
250 STARTTLS
mail from: <noreply@domain_on_dedi.com>
530 Must issue a STARTTLS command first

@eLIANT In phplist you need to send a test email when composing the campaign. The debug output then appears at the top of the page. That should show similar results to putty

530 Must issue a STARTTLS command first

You might not have the right combination of PHPMAILER_SECURE and PHPMAILERPORT in config.php. But that might be to do with using putty.

Increasing the value of PHPMAILER_SMTP_DEBUG to 2 or 3 should show more detail, which might help.

So this forum question has forked over to SMTP and PHPMailer.

Using PuTTY, I issued the following 4 lines:
openssl s_client -starttls smtp -crlf -connect mail.privateemail.com:587
mail from: noreply@concord-township.com
RCPT TO:pkelly@eliantservices.com
DATA

All was well until here, when the remote server replied that I had not specified any valid recipients. And that’s fine; I don’t care at this point. I’ve successfully connected from my server to the server providing the email services. All I have to do now is translate what I’ve done into the proper configs for PHPlist.

Is config/config.php the ONLY place I should change options?
What about admin/PHPMailer/class.smtp.php ?

I have define(‘PHPMAILER_SMTP_DEBUG’, 4);
And I’ve tried every combination of
PHPMAILERPORT (587, 465)
PHPMAILER_SECURE (‘ssl’, ‘tls’, false)

They all timeout.

@eLIANT Please show the debug output when trying to send a test email.
Use the code toolbar button < /> so that it is formatted as fixed width.

This is the debug output when I try to connect to your mail server using the same FROM address but made-up user and password

2021-09-26 09:14:57 Connection: opening to mail.privateemail.com:587, timeout=5, options=array()
2021-09-26 09:14:57 Connection: opened
2021-09-26 09:14:57 SERVER -> CLIENT: 220 PrivateEmail.com prod Mail Node
2021-09-26 09:14:57 CLIENT -> SERVER: EHLO strontian
2021-09-26 09:14:57 SERVER -> CLIENT: 250-mta-06.privateemail.com250-PIPELINING250-SIZE 81788928250-ETRN250-AUTH PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250-CHUNKING250 STARTTLS
2021-09-26 09:14:57 CLIENT -> SERVER: STARTTLS
2021-09-26 09:14:57 SERVER -> CLIENT: 220 Ready to start TLS
2021-09-26 09:14:57 CLIENT -> SERVER: EHLO strontian
2021-09-26 09:14:58 SERVER -> CLIENT: 250-mta-06.privateemail.com250-PIPELINING250-SIZE 81788928250-ETRN250-AUTH PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 CHUNKING
2021-09-26 09:14:58 CLIENT -> SERVER: AUTH LOGIN
2021-09-26 09:14:58 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2021-09-26 09:14:58 CLIENT -> SERVER: [credentials hidden]
2021-09-26 09:14:58 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2021-09-26 09:14:58 CLIENT -> SERVER: [credentials hidden]
2021-09-26 09:15:00 SERVER -> CLIENT: 535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
2021-09-26 09:15:00 SMTP ERROR: Password command failed: 535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6
SMTP Error: Could not authenticate.
2021-09-26 09:15:00 CLIENT -> SERVER: QUIT
2021-09-26 09:15:00 SERVER -> CLIENT: 221 2.0.0 Bye
2021-09-26 09:15:00 Connection: closed

If you are not getting even that far, then there might be a problem with the outgoing connection being blocked on the web server.

Here are my results:
Connection: opening to ssl://mail.privateemail.com:465, timeout=10, options=array ()
Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to ssl://mail.privateemail.com:465 (Connection timed out)
SMTP ERROR: Failed to connect to server: Connection timed out (110)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

(I’m not sure </> is working)

I’ve confirmed that ports 465 and 587 are open incoming and outgoing.

@eLIANT I was using PHPMAILERPORT 587 and PHPMAILER_SECURE tls.

The following TELNET exchange worked, and I received the test email, but for the life of me, every combination of PHPlist config parameters ends in failure. I don’t understand why TELNET works but not PHPlist. I’m going to download a fresh copy to see if there are differences between my PHPMailer and the fresh copy.

openssl s_client -starttls smtp -crlf -quiet -connect mail.privateemail.com:587 250 STARTTLS EHLO server1.elianthosting.com 250-mta-10.privateemail.com 250-PIPELINING 250-SIZE 81788928 250-ETRN 250-AUTH PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 CHUNKING AUTH LOGIN [Base64 encoded login name] 334 UGFzc3dvcmQ6 [Base64 encoded password] 235 2.7.0 Authentication successful MAIL FROM: 250 2.1.0 Ok RCPT TO: 250 2.1.5 Ok DATA 354 End data with . From: "PHPlist" To: "Phil Kelly" Subject: test of the telnet process Date: Fri, Sep 2021 16:11:00 -0500

Hello World.

Sincerely, PK

.
250 2.0.0 Ok: queued as 8FE5F18000A1
quit
221 2.0.0 Bye

No differences. And PrivateEmail.com, after being more helpful than any other service/software provider ever, has finally dropped this case because all my settings are correct and TELNET works, so the problem is not on their end. True enough; the problem must lay with PHPMailer.

So now I’m doing a line-by-line walkthrough of PHPMailer to see where the problem is.

Please, somebody stop me.

@eLIANT Are you able to send emails through any other application on the web server, such as Wordpress?

I host several websites, and most use email services from my server. Yes, I can send from my business email on my server to Gmail.

Also, are there any settings saved with the campaign that may be interfering? I’m resending the same test email over and over after changing config.php (Of course, I have to log out and start over in order to reload config.php.)

@eLIANT The campaign settings won’t be affecting this. The config.php file is read on each page load so you don’t need to logout.

Is this phplist installation https://concord-township.com/newsblast/ that you are testing? It is still using version 3.4.1 but you said that you had upgraded to latest, 3.6.4.

I think that the earlier release uses phpmailer 5, whereas now phpmailer 6 is the default.
In file admin/PHPMailer6/src/SMTP.php this is the function that tries to connect, line 372

protected function getSMTPConnection($host, $port = null, $timeout = 30, $options = [])

I’ve manually downloaded the latest version and am running PHPlist 3.6.4 and
PHPMailer6.

Same damn results.

Using port 486 SSL or TLS I get “Connection refused.”

2021-09-27 04:17:48 Connection: opening to mail.privateemail.com:486, timeout=11, options=array()
2021-09-27 04:17:48 Connection failed. Error #2: stream_socket_client(): unable to connect to mail.privateemail.com:486 (Connection refused) [/home/concord/public_html/newsblast/admin/PHPMailer6/src/SMTP.php line 387]
2021-09-27 04:17:48 SMTP ERROR: Failed to connect to server: Connection refused (111)

Using port 587 SSL or TLS I get “Connection timeout.”

2021-09-27 04:31:45 Connection: opening to ssl://mail.privateemail.com:587, timeout=9, options=array()
2021-09-27 04:31:54 Connection failed. Error #2: stream_socket_client(): unable to connect to ssl://mail.privateemail.com:587 (Connection timed out) [/home/concord/public_html/newsblast/admin/PHPMailer6/src/SMTP.php line 387]
2021-09-27 04:31:54 SMTP ERROR: Failed to connect to server: Connection timed out (110)

What the heck is going on?

@eLIANT You probably meant to use port 465 instead of 486.

But it looks like outgoing connections are being blocked by something. I’m not a system admin so don’t really know where to look. If you are knowledgeable enough then trying to monitor network traffic to the remote IP address or from the web server process might show something. netstat or tcpdump might do that.

From my desktop phplist can connect on port 465 with ssl, and port 587 with tls. Both then fail on the authentication.

Ooops. Of course, you’re right. I re-ran it using 465 and TLS and SSL… Same results.

This might be just a coincidence: When I installed the fresh version it was 3.6.4. Now today, 3.6.5 is available. I clicked “Updater” and got the page with the four icons: Initialize, Backup, Download, Perform update. “Initialize” was highlighted for a half-second, then when white. Since then nothing has happened. Previously, I told you I was running the latest version because I have the auto-update option turned on, but that’s evidently not working.

Is this a clue, or just a coincidence?

@eLIANT The auto update doesn’t always work very well, it does have some restrictions. Probably best to install 3.6.5 manually. I think that the new release came today.