Skip to content

Commit 6e3ed60

Browse files
committed
MimeMessageHelper does not encode attachment filenames by default anymore
Closes gh-25770
1 parent 07b3e92 commit 6e3ed60

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spring-context-support/src/main/java/org/springframework/mail/javamail/MimeMessageHelper.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public class MimeMessageHelper {
173173

174174
private FileTypeMap fileTypeMap;
175175

176-
private boolean encodeFilenames = true;
176+
private boolean encodeFilenames = false;
177177

178178
private boolean validateAddresses = false;
179179

@@ -490,9 +490,11 @@ public FileTypeMap getFileTypeMap() {
490490
/**
491491
* Set whether to encode attachment filenames passed to this helper's
492492
* {@code #addAttachment} methods.
493-
* <p>The default is {@code true} for compatibility with older email clients;
494-
* turn this to {@code false} for standard MIME behavior. On a related note,
493+
* <p>The default is {@code false} for standard MIME behavior; turn this to
494+
* {@code true} for compatibility with older email clients. On a related note,
495495
* check out JavaMail's {@code mail.mime.encodefilename} system property.
496+
* <p><b>NOTE:</b> The default changed to {@code false} in 5.3, in favor of
497+
* JavaMail's standard {@code mail.mime.encodefilename} system property.
496498
* @since 5.2.9
497499
* @see #addAttachment(String, DataSource)
498500
* @see MimeBodyPart#setFileName(String)

0 commit comments

Comments
 (0)