You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mailet-api@james.apache.org by "Craig Cudmore (JIRA)" <ma...@james.apache.org> on 2018/03/23 17:39:00 UTC
[jira] [Updated] (MAILET-162) Mailets (Bounce, Forward, etc) do not
handle multi-byte characters in the notice parameter
[ https://issues.apache.org/jira/browse/MAILET-162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Craig Cudmore updated MAILET-162:
---------------------------------
Description:
If the <notice> parameter of a Mailet contains multi-byte characters in the text the multibyte characters are not processed properly in the resulting message.
Example text:
<notice>Votre message a été rejeté</notice>
or
<notice>Votre message a été rejeté</notice>
This impacts the following mailets: Bounce, Forward, NotifyPostmaster, NotifySender, Redirect, Resend.
Code to fix this is as follows:
org.apache.james.transport.mailets.redirect.MailMessageAlteringUtils.java
Add imports:
import javax.activation.DataHandler;
import javax.mail.util.ByteArrayDataSource;
Modify method getBodyPart to:
private BodyPart getBodyPart(Mail originalMail, MimeMessage originalMessage, String head) throws MessagingException, Exception
{ MimeBodyPart part = new MimeBodyPart(); part.setDataHandler( new DataHandler( new ByteArrayDataSource( getText(originalMail, originalMessage, head), "text/plain; charset=UTF-8"))); part.setDisposition(javax.mail.Part.INLINE); return part; }
was:
If the <notice> parameter of a Mailet contains multi-byte characters in the text the multibyte characters are not processed properly in the resulting message.
Example text:
<notice>Votre message a été rejeté</notice>
or
<notice>Votre message a été rejeté</notice>
This impacts the following mailets: Bounce, Forward, NotifyPosmaster, NotifySender, Redirect, Resend.
Code to fix this is as follows:
org.apache.james.transport.mailets.redirect.MailMessageAlteringUtils.java
Add imports:
import javax.activation.DataHandler;
import javax.mail.util.ByteArrayDataSource;
Modify method getBodyPart to:
private BodyPart getBodyPart(Mail originalMail, MimeMessage originalMessage, String head) throws MessagingException, Exception {
MimeBodyPart part = new MimeBodyPart();
part.setDataHandler(
new DataHandler(
new ByteArrayDataSource(
getText(originalMail, originalMessage, head),
"text/plain; charset=UTF-8")));
part.setDisposition(javax.mail.Part.INLINE);
return part;
}
> Mailets (Bounce, Forward, etc) do not handle multi-byte characters in the notice parameter
> ------------------------------------------------------------------------------------------
>
> Key: MAILET-162
> URL: https://issues.apache.org/jira/browse/MAILET-162
> Project: James Mailet
> Issue Type: Improvement
> Components: Base Mailets
> Affects Versions: master
> Reporter: Craig Cudmore
> Priority: Minor
> Fix For: master
>
>
> If the <notice> parameter of a Mailet contains multi-byte characters in the text the multibyte characters are not processed properly in the resulting message.
> Example text:
> <notice>Votre message a été rejeté</notice>
> or
> <notice>Votre message a été rejeté</notice>
>
> This impacts the following mailets: Bounce, Forward, NotifyPostmaster, NotifySender, Redirect, Resend.
> Code to fix this is as follows:
> org.apache.james.transport.mailets.redirect.MailMessageAlteringUtils.java
> Add imports:
> import javax.activation.DataHandler;
> import javax.mail.util.ByteArrayDataSource;
> Modify method getBodyPart to:
> private BodyPart getBodyPart(Mail originalMail, MimeMessage originalMessage, String head) throws MessagingException, Exception
> { MimeBodyPart part = new MimeBodyPart(); part.setDataHandler( new DataHandler( new ByteArrayDataSource( getText(originalMail, originalMessage, head), "text/plain; charset=UTF-8"))); part.setDisposition(javax.mail.Part.INLINE); return part; }
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)