[ 
https://issues.apache.org/jira/browse/JAMES-1643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Suvega Srinivasan resolved JAMES-1643.
--------------------------------------
    Resolution: Fixed

Bernd Waibel Suggestion:
--------------------------------

as I understand, your problems are the missing " in creation-date and 
modification-date.
We do have this problem with wrong attachments headers in our James 2.3.2 on 
our production site, too, but till now only in Spam mails, so ignored till now.

This is an issue inside the mail.jar from Sun/Oracle. The parsing of the 
MimeBodyPart fails here. 
But there are some options to configure the parsing of mail.jar. See my post 
here:
http://mail-archives.apache.org/mod_mbox/james-server-user/201501.mbox/%[email protected]%3E
For additional information about the options see here: 
https://docs.oracle.com/javaee/6/api/javax/mail/internet/package-summary.html

The mail.jar released with James 2.3.2 is Version 1.4.1. So you need options 
which work with 1.4.1.
Not all configuration options (I mentioned in my post) are available in this 
version, so you may think about replacing the mail.jar with the newest Version 
1.4.7.
I am not sure if this would have side effects, we did it, but we did some 
changes in james 2.3.2 too (internally needed by our code).
If you do a replacement of the mail.jar, have a look if the mails are stored in 
the mail boxes, not sure if this will race problems.
There is also a 1.5.4 Version, but I never had a look at it.
See: http://www.oracle.com/technetwork/java/index-138643.html

I would recommend: start james with all options mentioned in my post 
(/var/james-2.3.2/bin/phoenix.sh).
If this will not work, try the options AND replace the mail.jar with mail.jar 
Version 1.4.7.

In our own code, we have a workaround for managing this:
Every time we try to read the ContentType, we do not use 
"part.getContentType()", we just use "part.getHeader("Content-Type").
By doing this, the ParameterList will not been parsed, and we do not need the 
ParameterList (in our code).
So if this happens in your own code (if you have own code, a mailet you have 
written or so), you may think about handling this on your own.
==========================================================


Suvega's implementation based on above:
-----------------------------------------------------

In james-2.3.2\conf\wrapper.conf file, added the following additional 
parameters and added javax.mail-1.4.7.jar to the 
\james-2.3.2\apps\james\SAR-INF\lib folder. Now able to process the RFC faulty 
emails with attachment/date field issue (bad Mime Content-Disposition:  
modification-date format).  

# Java Additional Parameters
wrapper.java.additional.6=-Dmail.mime.applefilenames=true 
wrapper.java.additional.7=-Dmail.mime.parameters.strict=false 
wrapper.java.additional.8=-Dmail.mime.ignoreunknownencoding=true 
wrapper.java.additional.9=-Dmail.mime.encodeeol.strict=true 
wrapper.java.additional.10=-Dmail.mime.multipart.ignoremissingendboundary=true 
wrapper.java.additional.11=-Dmail.mime.multipart.ignoremissingboundaryparameter=true
wrapper.java.additional.12=-Djava.net.preferIPv4Stack=true



> Unable to process message with attachment Content-Disposition issue 
> (creation-date)
> -----------------------------------------------------------------------------------
>
>                 Key: JAMES-1643
>                 URL: https://issues.apache.org/jira/browse/JAMES-1643
>             Project: James Server
>          Issue Type: Bug
>          Components: James Core
>    Affects Versions: 2.3.2
>         Environment: OS Name: Microsoft Windows Server 2012 R2 Standard
> System Type:  x64-based PC
> JRE:          1.7.0_75
> James Version:        james-2.3.2
>            Reporter: Suvega Srinivasan
>              Labels: easyfix, patch
>             Fix For: 2.3.2.1
>
>   Original Estimate: 168h
>  Remaining Estimate: 168h
>
> Issue Description:
> Our James mail server (2.3.2) was unable to process a mime message that had 
> attachment with Content-Disposition issue, the creation-date of mime message 
> from external mail server doesn’t have the quoted string and was not adhering 
> to RFC 2183. The message/attachment header dates are not encapsulated in 
> quotes. Is there a fix for James to resolve the issue at James Server side to 
> process or add the quoted string to Content-Disposition parameter values. 
> Other Findings: 
> This message sent from an external email server was well received and 
> processed by other email servers including MS Outlook exchange server. Since 
> email is failing in James alone, we wanted to know if there is a 
> workaround/fix available for James mail server to overcome this issue and 
> process the message.
> Mail Server Information:
> OS Name:      Microsoft Windows Server 2012 R2 Standard
> System Type:  x64-based PC
> JRE:          1.7.0_75
> James Version:        james-2.3.2
> Error message in James Mailet log:
> 04/11/15 15:34:32 INFO  James.Mailet: recepientFlag are: false
> 04/11/15 15:34:32 INFO  James.Mailet: AttachmentFileNameIs: Malformed message
> javax.mail.internet.ParseException: Expected ';', got ","
>                 at 
> javax.mail.internet.ParameterList.<init>(ParameterList.java:281)
>                 at 
> javax.mail.internet.ContentDisposition.<init>(ContentDisposition.java:100)
>                 at 
> javax.mail.internet.MimeBodyPart.getFileName(MimeBodyPart.java:1145)
>                 at 
> javax.mail.internet.MimeBodyPart.getFileName(MimeBodyPart.java:528)
>                 at 
> org.apache.james.transport.matchers.AttachmentFileNameIs.matchFound(AttachmentFileNameIs.java:183)
> Mime Message with issue, attachment content disposition:
> ----------------------------------------------------------------------------
> Content-Disposition: attachment;
>                 filename="8_pdfsam_2015.10.27 NCSU Blue Certificates 
> 1-41.pdf";
>                 size=1195923;
>                 creation-date=Mon, 02 Nov 2015 02:29:07 GMT;
>                 modification-date=Mon, 02 Nov 2015 02:29:07 GMT
> Content-ID: <[email protected]>
> Content-Transfer-Encoding: base64
> ----------------------------------------------------------------------------
> For your understanding of my issue, the correct format of attachment 
> content-disposition:
> ----------------------------------------------------------------------------
> Content-Disposition: attachment; filename=&quot;repDwnload.txt&quot;; 
> size=794;
>                 creation-date=&quot;Wed, 28 Oct 2015 05:27:20 GMT&quot;;
>                 modification-date=&quot;Wed, 28 Oct 2015 05:27:20 GMT&quot;
> Content-Transfer-Encoding: base64
> ----------------------------------------------------------------------------



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to