Add support for other mail parsing APIs such as mime4j
------------------------------------------------------

                 Key: MAILET-17
                 URL: https://issues.apache.org/jira/browse/MAILET-17
             Project: Mailet
          Issue Type: Improvement
          Components: Core API
            Reporter: Markus Wiederkehr


Currently the interface Mail is described as a wrapper around a MimeMessage 
with routing information. For various reasons it would be nice if the user 
could decide what mail API to use.

This could be accomplished by simply adding a method to retrieve the raw input 
stream of the message. The user can then use a mime4j parser or whatever API is 
best fitting to parse the input stream.

Implementing such a method in James shouldn't be too difficult since 
org.apache.james.core.MimeMessageSource already has a method to retrieve the 
raw input stream.

setMessage() would also have to be accompanied by a method to overwrite the raw 
content of the message. Preferably this method could return an output stream 
where the raw data can be written to.

Example code snippet of desired use case:

class MyMailet {
  public void service(Mail mail) {
    org.apache.james.mime4j.message.Message message = new 
Message(mail.getRawInputStream());
    message = manipulateMessage(message);
    message.writeTo(mail.getRawOutputStream(), MessageUtils.LENIENT);
  }
}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to