You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Guillermo Grandes (JIRA)" <se...@james.apache.org> on 2006/11/20 15:17:03 UTC

[jira] Commented: (JAMES-648) Corrupted MIME message with 8bit in body

    [ http://issues.apache.org/jira/browse/JAMES-648?page=comments#action_12451313 ] 
            
Guillermo Grandes commented on JAMES-648:
-----------------------------------------

Well, I have reviewed the problems, and I have found a small "sanitizer" for extrange Mails:

    try {
        MimeMessage message = (Mail)mail.getMessage();
        // Sanity of "Content-Transfer-Encoding" (non-existent header)
        if (message.getHeader("Content-Transfer-Encoding") == null) {
            BufferedInputStream is = new BufferedInputStream(message.getRawInputStream());
            while (is.available() > 0) {
                if (is.read() > 0x7F) {
                    log.warn(mail.getName() + ": 8bit Stream");
                    message.setHeader("Content-Transfer-Encoding", "8bit");
                    break;
                }
            }
            is.close();
        }
        // Sanity of "Content-Type" (multiple Content-Type headers)
        String [] heads = message.getHeader("Content-Type");
        if ((heads != null) && (heads.length > 1)) {
            message.setHeader("Content-Type", heads[heads.length-1]);
        }
        message.saveChanges();
    } catch (javax.mail.MessagingException me) {
        log.error("MessageingException", me);
    }

This piece of code can be used as Mailet.

> Corrupted MIME message with 8bit in body
> ----------------------------------------
>
>                 Key: JAMES-648
>                 URL: http://issues.apache.org/jira/browse/JAMES-648
>             Project: James
>          Issue Type: Bug
>    Affects Versions: Next Major
>         Environment: James 3.0
>            Reporter: Guillermo Grandes
>         Assigned To: Norman Maurer
>             Fix For: Next Major
>
>         Attachments: 4D61696C313135393436303732323938332D323834.Repository.FileStreamStore, james-proccesors.xml, traces.txt
>
>
> My config: Client (Mail-Orig) -> James (relay) -> Exchange -> Outlook (Reader)
> This is the mail received from an HP-Openview ServiceDesk (Mail-Orig) to James and relayed to Exchange:
> ----------- cut ----------- cut ----------- cut ----------- cut ----------- begin
> ------_=_NextPart_000_01C0B2DF.DE9D0F20
> Creada por: Explotación
> Archivo Adjunto?: No
> ------_=_NextPart_000_01C0B2DF.DE9D0F20--
> ----------- cut ----------- cut ----------- cut ----------- cut ----------- end
> (they would not have to appear the NextPart headers)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org