Attached email backup file as noname
After wp 5.5 update the attached backup file sent by email arrives with noname
Same problem here. Backup worked, updated WP to 5.5, e-mail attachements are broken.
Previous: X-Mailer: PHPMailer 5.2.27 Current: X-Mailer: PHPMailer 6.1.6
Previous: Content-Type: multipart/mixed; boundary="b1_56d2a9d3c58c5306a23e188ad7e0b57b"
Current: Content-Type: multipart/mixed; charset=
Guess: Missing "boundary" in the e-mail body. Thunderbird doesn't show any attachemt, K9-Mail/Android shows an error.
I've found the problem: PHPMailer has moved to another directory thus the "require_once" fails and the old method is used for sending the e-mail (which is buggy). The needed changes are two additional lines of code and one change to an existing line of code. Details tomorrow, if anybody is interrested in it.
First: PHPMailer has moved to a different location. In function send_mail() one has to include it
if ( !is_object( $phpmailer ) || ( strtolower(get_class( $phpmailer )) != 'phpmailer' ) ) {
// <fix for wp5.5>
if ( file_exists( ABSPATH . WPINC . '/PHPMailer/PHPMailer.php' ) )
require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
// </fix for wp5.5>
if ( file_exists( ABSPATH . WPINC . '/class-phpmailer.php' ) )
require_once ABSPATH . WPINC . '/class-phpmailer.php';
Second: strtolower(get_class( $phpmailer )) provides "phpmailer\phpmailer\phpmailer" thus the if-statement fails
// try to use phpmailer directly (WP 2.2+)
// <fix for wp5.5>
// if ( is_object( $phpmailer ) && ( strtolower(get_class( $phpmailer )) == 'phpmailer' ) ) {
if ( is_object( $phpmailer )
&& (
( strtolower(get_class( $phpmailer )) == 'phpmailer' )
||
( strtolower(get_class( $phpmailer )) == 'phpmailer\phpmailer\phpmailer' )
)
) {
// </fix for wp5.5>
Plugin works for me again with these changes. Just trying to provide a pull request now, please stand by.
Thank you, hgdrn. It works!