Make WordPress Core

Opened 11 years ago

Closed 10 months ago

#31775 closed enhancement (worksforme)

wp_mail attachments support only ascii symbols

Reported by: fike's profile Fike Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.1.1
Component: Mail Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Hi.
Currently wp_mail() passes it's attachments directly to PHPMailer, and that results in taking file basename as attachment name. Basename seems to behave not normal on non-ascii symbols, for example /сontacts.png (the first 'c' is russian) will be truncated as ontacts.png. Apart from that, even if it would be basename'd correctly, it won't be utf8-encoded as required by standard (=?utf-8?B?base64?=), and that will probably result in broken mails and/or rejected mails.

So i'm proposing to implement functionality for manual attachment naming and/or automatic basenaming filenames and encoding attachment names according to standard.

#28407 is tightly bound to this request.

Change History (4)

#1 @SergeyBiryukov
11 years ago

  • Description modified (diff)

#2 @cbutlerjr
10 years ago

Would resolving #28407 resolve this?

#3 @ocean90
5 years ago

#49033 was marked as a duplicate.

#4 @SirLouen
10 months ago

  • Resolution set to worksforme
  • Status changed from new to closed

Reproduction Report

Description

❌ This report can't validate that the issue can be reproduced.

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.29
  • Server: nginx/1.29.0
  • Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 138.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.3
  • MU Plugins: None activated
  • Plugins:
    • Testing Dolly
    • Test Reports 1.2.0

Testing Instructions

  1. Create a PDF name: сontacts.pdf (like in the OP Example)
  2. Use the 5th parameter of wp_mail to attach this file
  3. ✅ Attachment goes through perfectly.
  • Other filenames tests:

✅ 你好.pdf
✅ emoji-📄.pdf
✅ áéíóú.pdf

Actual Results

  1. ❌ Error condition not occurring.

Additional Notes

Note: See TracTickets for help on using tickets.