WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 5 months ago

#30204 new defect (bug)

wp_mail() bug with UTF-8-named attachment

Reported by: Blue Liquid Designs Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: External Libraries Keywords:
Focuses: Cc:
PR Number:

Description

Hi,

I came across a problem with phpmailer when attaching UTF-8 encoded files to the email. The file is correctly sent but the attached filename is incorrect.

For instance, Τεστ1_Τεστ2.pdf becomes 1_Τεστ2.pdf.

I tracked it down to line 1984 of /wp-includes/class-phpmailer.php, which is

$filename = basename($path);

From the research I did, unless the correct locale has been set using setlocale() before running basename() problems like this will occur.

The simple solution would be to run setlocale() for the correct language before sending mail, but it's not possible to determine the correct locale if you have users who write in multiple languages using the website.

Since WordPress has been pushing internationalisation hard in the last few updates this seems like another good step forward to support multi-languages.

Change History (2)

#1 @johnbillion
5 years ago

  • Component changed from Mail to External Libraries

Thanks for the report.

This needs to be reported upstream to PHPMailer: https://github.com/PHPMailer/PHPMailer/issues

#2 @johnbillion
5 years ago

  • Version trunk deleted
Note: See TracTickets for help on using tickets.