Questions tagged [mime4j]

mime4j is a Java Library for handling E-Mail according to rfc822 and MIME format is part of the Apache James project. The current (2014-07-18) stable version is 0.7.2

Summary Taken from: https://james.apache.org/mime4j/

Apache James Mime4J provides a parser, MimeStreamParser , for e-mail message streams in plain rfc822 and MIME format. The parser uses a callback mechanism to report parsing events such as the start of an entity header, the start of a body, etc. If you are familiar with the SAX XML parser interface you should have no problem getting started with mime4j.

The parser only deals with the structure of the message stream. It won't do any decoding of base64 or quoted-printable encoded header fields and bodies. This is intentional - the parser should only provide the most basic functionality needed to build more complex parsers. However, mime4j does include facilities to decode bodies and fields and the Message class described below handles decoding of fields and bodies transparently.

The parser has been designed to be extremely tolerant against messages violating the standards. It has been tested using a large corpus (>5000) of e-mail messages. As a benchmark the widely used perl MIME::Tools parser has been used. mime4j and MIME:Tools rarely differ (<25 in those 5000). When they do (which only occurs for illegally formatted spam messages) we think mime4j does a better job.

mime4j can also be used to build a tree representation of an e-mail message using the Message class. Using this facility mime4j automatically handles the decoding of fields and bodies and uses temporary files for large attachments. This representation is similar to the representation constructed by the JavaMail API:s but is more tolerant to messages violating the standards.

Using mime4j with Maven

    <!-- EMail handling -->
    <dependency>
        <groupId>org.apache.james</groupId>
        <artifactId>apache-mime4j-core</artifactId>
        <version>0.7.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.james</groupId>
        <artifactId>apache-mime4j-dom</artifactId>
        <version>0.7.2</version>
    </dependency>

Issues

https://issues.apache.org/jira/browse/MIME4J

Mailinglist

https://james.apache.org/mime4j/mail-lists.html

29 questions
0
votes
0 answers

mime4j - How to efficiently parse very-large headers-only mbox files by adjusting mime4j configuration

I am using mime4j for email parsing. I sometimes receive mbox files that are not a conventional header-followed-by-body type of email, but are simply a collection of headers. Something like the following: Delivered-To: user1@company1.com From:…
Timothy Clotworthy
  • 1,960
  • 2
  • 19
  • 42
0
votes
0 answers

Parsing jakarta.mail Message using tech.blueglacier.email-mime-parser library

I am connecting to the a Gmail account and I try to read the unseen email using Jakarta Mail API. I try to use the tech.blueglacier.email-mime-parser library which is based on org.apache.james.mime4j in order to parse the Message and get the content…
Iulian
  • 11
  • 5
0
votes
0 answers

resteasy enable strict parsing with mime4j

is there a way to set mime4j strict parsing to true for resteasy without hacking into and extending MultipartFormDataInputImpl? according to mime4j 0.8 javadoc, the default value is false. we want to have it throw an exception rather than having a…
Joseph
  • 97
  • 2
  • 15
0
votes
1 answer

Find byte offsets for e-mail attachments

I got a requirement to deliver emails to a legacy system that needs to read the attachments. For each part in a multipart email I need to provide the byte offset for where the attachment starts in the email, so the legacy system doesn't need to know…
Lasse L
  • 1,278
  • 1
  • 9
  • 14
0
votes
1 answer

Mime4j - Sending email through SMTP Server

I've implemented a solution to parse Email Files (.eml) into objects using Mime4J. The process parses an email file, create an object and write a new file to disk. I was wondering if is possible to send the MimeMessage of Mime4J through …
user866364
0
votes
2 answers

java.lang.NoSuchMethodError when sending mail using Apache James 3

I just downloaded and setup the Apache James 3 latest beta release on Windows and so far i haven't been able to send a simple message. It looks like there is an issue with the build. The error is - ERROR 22:45:01,666 | james.mailspooler | Exception…
Jay
  • 1,392
  • 7
  • 17
  • 44
0
votes
0 answers

Scala: parse MIME/multipart raw emails over HTTP one at a time

I'm trying to parse raw email messages over HTTP one at a time that come in MIME/multipart. Here is a chunk of one of the mails, the mail that my code most recently threw this exception on java.nio.charset.MalformedInputException: Input length =…
plamb
  • 5,636
  • 1
  • 18
  • 31
0
votes
0 answers

How to create mime-attachment soap message in java

I need to send SOAP message with mime-attachment into my web-service. I wrote this code for it: File file = new File(fileName); DataSource ds = new FileDataSource(file) { public String getContentType() { return…
Giymose
  • 201
  • 1
  • 6
  • 21
0
votes
0 answers

Example of parser using Mime4j 0.7.2 version

I've a lot of .eml files and need to parse them. I'm using mime4j version 0.6.1 and wanna to update to version 0.7.2, but cannot find any good sample. I read post apache mime4j maven dependency for 0.7.2 and it helped me to get right maven…
rado
  • 95
  • 1
  • 11
0
votes
1 answer

How to Parse MIME without multiple parts in it

I need __content__ part from the following response string in java Content-Type: application/xml; charset=UTF-8; name=response_xml...
Jeyasithar
  • 543
  • 4
  • 17
0
votes
1 answer

Android: post to a password protected server

I am trying to send information from my Android device to my php server. I followed this tutorial (http://www.codeofaninja.com/2013/04/android-http-client.html), but then realized there is nowhere to specify my useID and password to log into the…
-2
votes
1 answer

Parsing email file with mime4J

I found this example for parsing an email: http://www.mozgoweb.com/posts/how-to-parse-mime-message-using-mime4j-library/ But the example is not working, because import org.apache.james.mime4j.message.Message; is not working. How can I create a…
Peter
  • 1,011
  • 2
  • 16
  • 39
-2
votes
1 answer

How to extract attachment using Mime4j 0.7.2

Can anybody help in pointing me to some code to extract attachments from Multipart Mime using Mime4j? I couldn't find any, I need it for Mime4j 0.7.2(latest). I am trying to process attachments from James Hook/Mailets.
Sathish Kumar
  • 313
  • 2
  • 15
1
2