Remember this is a local install on Windows 10 with XAMPP
I noticed in the XAMPP control panel, with Apache, there is a config file with SMTP stuff.
I tried different SMTP setting according to hostgator. Here is the link to hostgator SMTP settings: https://www.hostgator.com/help/article/email-connection-settings
Why is POP3 not a solution? It works fine for outlook and mailmerge?
Here is the results of different options.
Config:
define(‘HASH_ALGO’, ‘sha256’);
// SMTP NO SSL Unsecure
$phpmailer = ‘1’;
define(“PHPMAILER_SECURE”,‘false’);
define(‘PHPMAILERHOST’,‘mail.mydomain.org’);
$phpmailer_smtpuser = ‘newsletter@mydomain.org’;
$phpmailer_smtppassword = ‘Mypassword!’;
define(“PHPMAILERPORT”, ‘25’);
define(‘PHPMAILER_SMTP_DEBUG’, 4);
Debug Messages:
2024-05-08 20:40:56 Connection: opening to mail.mydomain.org:25, timeout=5, options=array()
2024-05-08 20:40:56 Connection: opened
2024-05-08 20:41:02 SMTP INBOUND: “220-cloud265.hostgator.com ESMTP Exim 4.96.2 #2 Wed, 08 May 2024 15:41:02 -0500”
2024-05-08 20:41:02 SMTP INBOUND: “220-We do not authorize the use of this system to transport unsolicited,”
2024-05-08 20:41:02 SMTP INBOUND: “220 and/or bulk e-mail.”
2024-05-08 20:41:02 SERVER → CLIENT: 220-cloud265.hostgator.com ESMTP Exim 4.96.2 #2 Wed, 08 May 2024 15:41:02 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2024-05-08 20:41:02 CLIENT → SERVER: EHLO localhost
2024-05-08 20:41:02 SMTP INBOUND: “250-cloud265.hostgator.com Hello localhost [172.56.106.212]”
2024-05-08 20:41:02 SMTP INBOUND: “250-SIZE 52428800”
2024-05-08 20:41:02 SMTP INBOUND: “250-8BITMIME”
2024-05-08 20:41:02 SMTP INBOUND: “250-PIPELINING”
2024-05-08 20:41:02 SMTP INBOUND: “250-PIPECONNECT”
2024-05-08 20:41:02 SMTP INBOUND: “250-AUTH PLAIN LOGIN”
2024-05-08 20:41:02 SMTP INBOUND: “250-STARTTLS”
2024-05-08 20:41:02 SMTP INBOUND: “250 HELP”
2024-05-08 20:41:02 SERVER → CLIENT: 250-cloud265.hostgator.com Hello localhost [172.56.106.212]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPECONNECT250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2024-05-08 20:41:02 CLIENT → SERVER: STARTTLS
2024-05-08 20:41:02 SMTP INBOUND: “220 TLS go ahead”
2024-05-08 20:41:02 SERVER → CLIENT: 220 TLS go ahead
2024-05-08 20:41:02 Connection failed. Error #2: stream_socket_enable_crypto(): Peer certificate CN=*.hostgator.com' did not match expected CN=
mail.mydomain.org’ [C:\xampp\htdocs\lists\admin\PHPMailer6\src\SMTP.php line 467]
SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto(): Peer certificate CN=*.hostgator.com' did not match expected CN=
mail.mydomain.org’
2024-05-08 20:41:03 CLIENT → SERVER: QUIT
2024-05-08 20:41:03
2024-05-08 20:41:03
2024-05-08 20:41:03
2024-05-08 20:41:03 Connection: closed
SMTP connect() failed. Troubleshooting · PHPMailer/PHPMailer Wiki · GitHub
****These statement when test email is sent, there is no return, just spins.
Config – SSL with Port 465
define(‘HASH_ALGO’, ‘sha256’);
//mail server statements added
$phpmailer = ‘1’;
define(“PHPMAILER_SECURE”,‘AUTO’);
define(‘PHPMAILERHOST’,‘mail.mydomain.org’);
$phpmailer_smtpuser = ‘newsletter@mydomain.org’;
$phpmailer_smtppassword = ‘Mypassword!’;
define(“PHPMAILERPORT”, ‘465’);
define(‘PHPMAILER_SMTP_DEBUG’, 4);
****These statements are identical from about with exception of SSL instead of AUTO – no return
define(‘HASH_ALGO’, ‘sha256’);
//mail server statements added
$phpmailer = ‘1’;
define(“PHPMAILER_SECURE”,‘SSL’);
define(‘PHPMAILERHOST’,‘mail.mydomain.org’);
$phpmailer_smtpuser = ‘newsletter@mydomain.org’;
$phpmailer_smtppassword = ‘Mypassword!’;
define(“PHPMAILERPORT”, ‘465’);
define(‘PHPMAILER_SMTP_DEBUG’, 4);
****These statements are identical from about with exception of SSL instead of AUTO – no return
//mail server statements added
$phpmailer = ‘1’;
define(“PHPMAILER_SECURE”,‘IMAP’);
define(‘PHPMAILERHOST’,‘mail.mydomain.org’);
$phpmailer_smtpuser = ‘newsletter@mydomain.org’;
$phpmailer_smtppassword = ‘Mypassword!’;
define(“PHPMAILERPORT”, ‘143’);
define(‘PHPMAILER_SMTP_DEBUG’, 4);