by
KK » Thu Apr 10, 2025 3:26 pm
Hi again,
It seems there is indeed a bug with PHP 8.x that causes the problem you are experiencing
-
https://github.com/PHPMailer/PHPMailer/pull/2188To fix it, please try the following two steps-
1. As already mentioned before, if not already done so, please switch to PHPMailer.
To do that, find the highlighted directive below in your couch/config.php file and
change its value from 0 to 1 // 15.
// By default the inbuilt php function 'mail()' is used to deliver messages.
// On certain hosts this function might fail due to configuration problems.
// In such cases, set the following to '1' to use an alternative method (phpMailer) to send emails
define( 'K_USE_ALTERNATIVE_MTA', 1 );
2. Just the first step above, however, is not sufficient.
We also need to make PHPMailer use SMTP as its method of sending emails.
To do that, do the following -
In your 'couch/addons/phpmailer' folder you'll find a file named 'config.example.php'.
Please rename it to 'config.php'
The default settings given in this file assume that you have an external SMTP server (e.g. GMail etc.) and you have the username/password for the account used to send emails.
For your case, we'll instead use the SMTP server that already exists on your web-server (localhost) which is what PHP uses by default and, using which, your emails have been going through fine so far.
To configure that, please make the settings in the file in question to match the follows -
- Code: Select all
<?php
if ( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly
// 1. Method used for sending emails.
//
// Four valid options available:
// 'smtp' - Send messages using SMTP (e.g. GMail).
// 'mail' - Send messages using PHP's mail() function.
// 'sendmail' - Send messages using $Sendmail.
// 'qmail' - Send messages using qmail.
//
$cfg['method'] = 'smtp';
// 2. SMTP settings: required only if $cfg['method'] above is set to 'smtp'.
$cfg['host'] = ''; // Address of the SMTP server. If left empty, defaults to 'localhost'.
$cfg['port'] = ''; // Port of the SMTP server. If left empty, defaults to '25'.
$cfg['secure'] = ''; // encryption to use on the SMTP connection. Valid options are '', 'ssl' or 'tls'.
$cfg['authentication_required'] = '0'; // set this to '0' if your SMTP server does not require authentication
// If 'authentication_required' above is set to '1', the following credentials will be required
//$cfg['username'] = 'your_email@gmail.com';
//$cfg['password'] = 'your_password';
// 3. Debug. If set to '1', will log all debug output in 'log.txt' at site's root.
$cfg['debug'] = '0';
The settings above will make PHPMailer use the localhost SMTP server with no authentication required.
This should rectify the PHP 8 problem with email formatting.
Please try it and let me know if this helps.