Craig Cudmore created MAILET-162: ------------------------------------ Summary: 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 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, 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; } -- This message was sent by Atlassian JIRA (v7.6.3#76005)