simple-java-mail | Simple API , Complex Emails | Email library

 by   bbottema Java Version: 8.3.1 License: Apache-2.0

kandi X-RAY | simple-java-mail Summary

kandi X-RAY | simple-java-mail Summary

simple-java-mail is a Java library typically used in Messaging, Email applications. simple-java-mail has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, GitLab, Maven.

Simple Java Mail is the simplest to use lightweight mailing library for Java, while being able to send complex emails including CLI support, authenticated socks proxy(!), attachments, embedded images, custom headers and properties, robust address validation, build pattern and even DKIM signing, S/MIME support and external configuration files with property overriding, Spring support and Email conversion tools. Just send your emails without dealing with RFCs. The Simple Java Mail library is a thin layer on top of Jakarta Mail that allows users to define emails on a high abstraction level without having to deal with mumbo jumbo such as 'multipart' and 'mimemessage'.

            kandi-support Support

              simple-java-mail has a medium active ecosystem.
              It has 1093 star(s) with 247 fork(s). There are 36 watchers for this library.
              There were 5 major release(s) in the last 6 months.
              There are 15 open issues and 389 have been closed. On average issues are closed in 101 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of simple-java-mail is 8.3.1

            kandi-Quality Quality

              simple-java-mail has 0 bugs and 0 code smells.

            kandi-Security Security

              simple-java-mail has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              simple-java-mail code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              simple-java-mail is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              simple-java-mail releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              simple-java-mail saves you 9981 person hours of effort in developing the same functionality from scratch.
              It has 20639 lines of code, 2243 functions and 258 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed simple-java-mail and discovered the below as its top functions. This is intended to give you an instant insight into simple-java-mail implemented functionality, and help decide if they suit your requirements.
            • Loads the default mailer
            • Loads properties from an input stream
            • Read properties
            • Parses the property value as a boolean
            • Sends the email
            • Converts a MimeMessage to an EML string
            • Logs the email message
            • Returns a string representation of this email
            • Formats a date
            • String representation of this instance
            • Populates the mime message with the given mime message
            • Populates the mime - part structure from an email message
            • Returns a string representation of this request
            • Initializes the given session
            • Populates the mime message from an email
            • Populates the Mime - Multipart from an email
            • Initializes a Kryo instance
            • Produce the initial cli declared options
            • Configures the session with the specified proxy configuration
            • Sign message with DKIM
            • Start the proxy server
            • Instantiates the session instance
            • Starts the socks5 bridge server
            • Merge other smime details into this object
            • Close socket
            • Configure the pico command line interface
            Get all kandi verified functions for this library.

            simple-java-mail Key Features

            No Key Features are available at this moment for simple-java-mail.

            simple-java-mail Examples and Code Snippets

            No Code Snippets are available at this moment for simple-java-mail.

            Community Discussions


            How to verify that all own thrown runtime exceptions are covered in Javadoc?
            Asked 2020-Jan-07 at 15:19

            I throw a bunch of custom runtime exceptions in my code and I want to make sure that in all public methods, I document which runtime exception might be thrown (by myself) and why. This would be very hulpful since I'm maintaining a library which is used by many projects and I want it to be upfront and predictable regarding thrown (runtime) exceptions.

            Is there a compiler option, maven plugin, Intellij plugin or custom tool that can help me find missed throws clauses? With checked exceptions it's easy, the compiler will just complain if I missed one, but for runtime exceptions both throws and @throws are not enforced.

            One thing I thought of was to temporarily make all my own runtime exceptions checked exceptions (they already share a super class), but that would be a one-off exercise. I would like to verify my code/documentation each time I make changes so I can never forget to document my runtime exceptions.

            Another way could be to actually have checked exceptions throughout the code and convert them to runtime only in the public api:



            Answered 2019-Oct-18 at 23:59

            After understanding your question and researching this subject, I finally found what I thought to be one of the best tools to do this job. With this not only you can find each throws instance that you haven't documented, but you can also find where you don't throw anything but accidentally document a throw value.

            The idea behind this is to parse the code into an abstract syntax tree. Then look for methods and look for throws statement in the methods. If a method have any throw statement, extract the exception name from those statements. Then get the Javadoc for that method. Check the Javadoc for all the @throw tags and get the name of the exception that been documented. After that, compare the exception throws versus the one that been documented. The last, you kind of have to figure that out on your own depend on your usage circumstance.

            The tool I used for this is JavaParser. You can find them on Github at I downloaded their latest version. Their website is at They wrote a book on this subject and they mentioned that you can pay $0 dollar for the book. However, I didn't read that as they also have a Javadoc version for their program which can be found at

            I wrote a demonstrate code below. In no mean that this code is final. It is just an example. You have to fix it into making it work for your case. I didn't take into consideration of nested classes, nested method, or methods within classes that are within a method. Also, the example code was written for class only and not interface. However, it is easy to adapt the code to change to able to handle interfaces.

            For this, you would need to download javaParser, build it, and have their javaparser-core-3.15.1.jar or whichever version in your classpath.

            The demonstrated code is below and the is a file from a project that I wrote but you could use any. I also included comments in the example code.



            Which SMTP sever to send Java Mail to when the server is cloud-based?
            Asked 2019-Nov-21 at 18:21

            Java 8 here, although this really is more of a generic Exchange/SMTP question I suppose.

            I purchased a domain name and Office 365 support from GoDaddy, and as a result, have several email addresses through them. Let's say one of these is

            I am writing a Java 8 app that will allow users to send emails to this support address (through the app). I will likely use the excellent Simple Java Mail library, which wraps the Java Mail API. And so somewhere in my app there will be some code that looks something like:



            Answered 2019-Nov-21 at 18:21

            That depends a little bit on what you want to do.

            If you just want to make one attempt to send the mail, you connect to the mail server that accepts mail for It sounds like this is an office365 server owned by Microsoft that accepts mail for There should be public DNS records for that domain. I haven't used the Simple Java Mail library, but from your pseudocode, I assume it does the DNS lookups for you.

            It sometimes happens that an application encounters errors when trying to send an email. For example, somebody could restart your app server in the middle of the smtp conversation, or reboot your router, or something else. It's pretty common to use a Mail Transfer Agent (MTA) such as Exchange to help make this process more robust. If the MTA fails on the first delivery attempt, it will retry delivery for some configurable period of time. In your case, you could send the email to your Exchange server, and it would route the email to

            (In this case, Exchange is sort of acting as a Mail Submission Agent (MSA), but that's kind of a nitpick.)

            Hope this helps.



            Spring Boot Application not starting. Error: Stopping Service [Tomcat]
            Asked 2019-Sep-19 at 12:22

            I am not able to run my Spring Boot application with embedded Tomcat. It was working fine till now and I did not make any changes in configuration. When i run the application as Spring Boot App in eclipse the tomcat stops immediately during startup.



            Answered 2019-Feb-06 at 09:04

            The error you get seems related to SLF4J

            Try adding the below dependencies in your pom.xml



            How to know where the class is coming from in Java
            Asked 2019-Jun-24 at 21:58

            I faced a very confusing problem today where my email service, I am using simple-java-mail, stopped sending all in a sudden.. and an exception was raised:



            Answered 2019-Jun-24 at 21:58

            With this snippet you can figure out from where this class is coming from, and so find the source of a class immediately:



            Load pdf file to jar already built
            Asked 2019-May-28 at 23:12

            I'm trying to get some specific data from a pdf and save it in a database. The idea is that in my program when you press a button, with selenium, the program downloads the pdf and uploads it to the jar in order to read it.

            I tried many libraries to read pdfs but all seems to be stuck in the same place: when I try to load the pdf.

            If I compile the program in IntelliJ it works perfect, the problem is when I compile it to .jar. It gets stuck when loading and does not show an error. Tried everything I could but nothing works.

            Heres how my code looks right now:



            Answered 2019-May-23 at 16:51

            That exception looks like you dont have the correct dependency in your maven repository. Try to see if both PdfReader functions have the same dependency. Like you say, you tried so much librarys, maybe two of them have the same name function and you are mixed them in some way.



            Debug Stream trace on functional code throws IncompatibleClassChangeError
            Asked 2019-Mar-24 at 09:10

            When I tried to debug the stream in the code below via Stream Trace in IntelliJ, the debugger can't evaluate the foreach because the error below is thrown. I have no idea what it's about, the code by itself runs fine.

            Fully updated IntelliJ community edition, JUnit 5, Spring Boot, Maven, Java 11.

            The error that happens during Stream Trace debugging only:

            java.lang.IncompatibleClassChangeError: Type com.progonkpa.file.FileService$GeneratedEvaluationClass$5 is not a nest member of com.progonkpa.file.FileService: types are in different packages

            The code that contains the stream:



            Answered 2019-Mar-23 at 15:25

            The Stream debugger apparently generates bytecode and defines classes on the fly to evaluate expressions. Relevant source files are


            And there is a currently opened issue on YouTrack, with the exact same exception



            Class EmailAddressCriteria not found (SimpleJavaMail)
            Asked 2018-Jul-12 at 21:36

            I try to use the SimpleJavaMail library, but I think I missed something when importing the JAR of the API and it's dependencies. I use Java 8 (openjdk), and here is a list of the external JARs I added in my Eclipse Oxygen project configuration :

            • slf4j-api-1.7.13.jar (the 1.7.13 version seems to be the version of SLF4J used in SimpleJavaMAil since version 2.5.1 according to its GitHub)
            • slf4j-simple-1.7.13.jar
            • javax.mail.jar version 1.6.1
            • simple-java-mail-5.0.3.jar

            Here is a code sample:



            Answered 2018-Jul-12 at 21:36

            Looking at Maven Central's pom.xml for simple-java-mail-5.0.3 you are missing the following dependency



            In-memory testing using Jersey Test Framework, TestNG and Maven
            Asked 2017-Nov-12 at 08:07

            I am building a web project which uses Maven for building and uses Jersey for RESTful API. I have written unit tests using TestNG and Jersey Test Framework and am running them in-memory and not on a web server.

            In my tests I make a JDBC call to my MySQL database and get some results. The tests run fine when I run from within Eclipse using the TestNG for Eclipse plugin. However, when I try running from Maven using either of the two commands:



            Answered 2017-Nov-12 at 08:07

            There are several issues with your pom.xml file.

            First the scope for mysql-connector-java in dependencyManagement section is defined incorrectly:



            How to tokenize, scan or split this string of email addresses
            Asked 2017-Aug-23 at 15:22

            For Simple Java Mail I'm trying to deal with a somewhat free-format of delimited email addresses. Note that I'm specifically not validating, just getting the addresses out of a list of addresses. For this use case the addresses can be assumed to be valid.

            Here is an example of a valid input:



            Answered 2017-Aug-22 at 20:41

            since you are not validating, i assume that the email addresses are valid. Based on this assumption, i will look up an email address followed by ; or , this way i know its valid.



            Using JavaMail with SSL and TLS
            Asked 2017-Mar-08 at 06:24

            I am using simple-java-mail API which is a wrapper on top of JavaMail API. I am sending emails with my Gmail account credentials. I am mentioning what I am able to do and what not with this.

            I am able to send emails perfectly with the following settings and properties.



            Answered 2017-Mar-08 at 06:24

            Thanks everyone. Issue was with my company's network. Network team updated that outgoing SMTP requests are blocked on port 25 and 587. With my personal wifi network, everything working like charm.

            So For GMAIL, my settings are as follows for each of the 3 ports provided by GMAIL. And I found there is no need to set the session properties explicitly with simple-java-mail API.

            With Port 25


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install simple-java-mail

            You can download it from GitHub, GitLab, Maven.
            You can use simple-java-mail like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the simple-java-mail component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer For Gradle installation, please refer .


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone bbottema/simple-java-mail

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Email Libraries


            by PHPMailer


            by nodemailer


            by mjmlio


            by Foundry376


            by postalserver

            Try Top Libraries by bbottema


            by bbottemaJava


            by bbottemaJavaScript


            by bbottemaTypeScript