Giter VIP home page Giter VIP logo

Comments (5)

bbottema avatar bbottema commented on August 17, 2024

If you provide an implementation or piece of code that fills an Email instance completely using a MimeMessage, I will integrate it into Simple Email.

from simple-java-mail.

bbottema avatar bbottema commented on August 17, 2024

The truth is, MimeMessage is a ambiguous type tree structure. The Email class works exactly why MimeMessage doesn't: it has a simple interface and it allows you do define an email in exactly one way. MimeMessage on the other hand is a messy heap of recursive nonsense and extracting data from that is a lot harder than putting data into it.

from simple-java-mail.

bbottema avatar bbottema commented on August 17, 2024

On the other hand, Apache seems to have an implementation already. I might just use some of that.

from simple-java-mail.

bbottema avatar bbottema commented on August 17, 2024

@neil-ceschi, I implemented a MimeMessage parser based on Apache's version. I had to modify a few a few things: headers were not parsed in Apache's version and attachments and embedded images were not properly distinguished (they ignored Part.INLINE and Part.ATTACHMENT predispositions).

I'll release a new version somewhere this week when I have the time. Releasing always takes me more time than implementing an actual fix :/

Usage:

Email email = new Email(yourMimeMessage);
// the other way around is now possible too!
MimeMessage mimeMessage = Mailer.produceMimeMessage(yourEmail, yourSession /* or null */);

The following should be true then:

Email emailSource = new Email();
/* populate email... */
Email emailTarget = new Email(mailer.produceMimeMessage(emailSource, null));

emailSource.equals(emailTarget);

from simple-java-mail.

bbottema avatar bbottema commented on August 17, 2024

Release in v3.0.0!

Demo included in MailTest.java

from simple-java-mail.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.