-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit c166198.
- Loading branch information
Showing
2 changed files
with
8 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
import jakarta.mail.MessagingException; | ||
import jakarta.mail.Multipart; | ||
import jakarta.mail.Part; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
||
/** | ||
* @author Russ Poetker ([email protected]) | ||
|
@@ -32,7 +31,7 @@ private MailUtil() {} | |
|
||
static String getHtmlText(Part part) throws MessagingException, IOException { | ||
if (part.isMimeType("text/html")) { | ||
return cleanseContent(part.getContent().toString()); | ||
return part.getContent().toString(); | ||
} | ||
|
||
if (part.isMimeType("multipart/alternative")) { | ||
|
@@ -41,7 +40,7 @@ static String getHtmlText(Part part) throws MessagingException, IOException { | |
for (int i = 0; i < count; i++) { | ||
Part bodyPart = multipart.getBodyPart(i); | ||
if (bodyPart.isMimeType("text/html")) { | ||
return cleanseContent(bodyPart.getContent().toString()); | ||
return bodyPart.getContent().toString(); | ||
} else if (bodyPart.isMimeType("multipart/*")) { | ||
return getHtmlText(bodyPart); | ||
} | ||
|
@@ -53,15 +52,11 @@ static String getHtmlText(Part part) throws MessagingException, IOException { | |
Part bodyPart = multipart.getBodyPart(i); | ||
String content = getHtmlText(bodyPart); | ||
if (Objects.nonNull(content)) { | ||
return cleanseContent(content); | ||
return content; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
private static String cleanseContent(String content) { | ||
return StringUtils.normalizeSpace(content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters