Questions tagged [jakarta-mail]

A Java API to send and receive emails. Jakarta Mail (previously JavaMail) is part of Jakarta EE (previously Java EE), but can also be used in Java SE via a separate download.

Jakarta Mail (previously JavaMail) is a Java API used to send and receive email via SMTP, POP3 and IMAP. Jakarta Mail is built into the Jakarta EE platform, but also provides an optional package for use in Java SE.

The current version and last release in the 1.x line is 1.6.5, released on March 10, 2020. Another open source JavaMail implementation exists - GNU JavaMail - while supporting only version 1.3 of the JavaMail specification, it provides the only free NNTP backend, which makes it possible to use this technology to read and send news group articles.

In 2018 JavaMail became part of the EE4J initiative under the Eclipse Foundation, and was renamed to Jakarta Mail.

Useful links

Related Tags:

5039 questions
674
votes
25 answers

Sending Email in Android using JavaMail API without using the default/built-in app

I am trying to create a mail sending application in Android. If I use: Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); This will launch the built-in Android application; I'm trying to send the mail on button click directly…
Vinayak Bevinakatti
  • 38,839
  • 25
  • 103
  • 135
534
votes
46 answers

Error - trustAnchors parameter must be non-empty

I'm trying to configure my e-mail on Jenkins/Hudson, and I constantly receive the error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty I've seen a good amount of information online about the…
David Gill
  • 7,761
  • 5
  • 17
  • 20
214
votes
14 answers

How can I send an email by Java application using GMail, Yahoo, or Hotmail?

Is it possible to send an email from my Java application using a GMail account? I have configured my company mail server with Java app to send email, but that's not going to cut it when I distribute the application. Answers with any of using…
Bill the Lizard
  • 369,957
  • 201
  • 546
  • 842
140
votes
8 answers

java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger for JUnit test case for Java mail

I am using Java Mail API to read and parse emails. It is working fine with Servlet code. Now I am trying to write a JUnit test case for the same purpose. But on line Session session = Session.getDefaultInstance(properties); I am getting the…
user2215139
  • 1,615
  • 2
  • 17
  • 24
124
votes
10 answers

How do I send an HTML email?

I have successfully sent email in my web application using JMS, but the result only displays in plain text. I want the content to be able to display html. How do I do it? Here is roughly what I have: Message msg = new MimeMessage(mailSession); try{ …
Thang Pham
  • 35,825
  • 73
  • 192
  • 279
97
votes
5 answers

Download attachments using Java Mail

Now that I`ve downloaded all the messages, and store them to Message[] temp; How do I get the list of attachments for each of those messages to List attachments; Note: no thirdparty libs, please, just JavaMail.
folone
  • 8,177
  • 11
  • 61
  • 105
90
votes
3 answers

Which artifact for org.springframework.mail?

I'd like to use spring support for sending mails. My project is built with maven-2 and I use spring-core 2.5.5 I tried to look in maven central repo for artifact to include in my pom.xml, and the only one I found is spring support. The problem is…
Tadeusz Kopec
  • 11,984
  • 6
  • 51
  • 79
85
votes
12 answers

Send Mail to multiple Recipients in java

I want to send a message to multiple Recipients using following the method : message.addRecipient(Message.RecipientType.TO, String arg1); OR message.setRecipients(Message.RecipientType.TO,String arg1); But one confusion is that in second…
Prateek
  • 11,146
  • 11
  • 54
  • 77
77
votes
10 answers

Getting mail from GMail into Java application using IMAP

I want to access messages in Gmail from a Java application using JavaMail and IMAP. Why am I getting a SocketTimeoutException ? Here is my code: Properties props = System.getProperties(); props.setProperty("mail.imap.host",…
Dave
  • 1,481
  • 1
  • 11
  • 8
64
votes
1 answer

how to send HTML email

I have to send HTML file via email but not as attachment. Message simpleMessage = new MimeMessage(mailSession); try { fromAddress = new InternetAddress(from); toAddress = new InternetAddress(to); } catch (AddressException e) { // TODO…
Prerna
  • 1,215
  • 4
  • 17
  • 22
61
votes
13 answers

package javax.mail and javax.mail.internet do not exist

When I compile a simple code that has the following 2 import statements: import javax.mail.* import javax.mail.internet.* I get the following message: package javax.mail does not exist package javax.mail.internet does not exist Why do I get this…
saplingPro
  • 18,513
  • 51
  • 134
  • 185
59
votes
16 answers

Javamail Could not convert socket to TLS GMail

I am trying to send an email using JavaMail through gmails SMTP Server. however this code. final String username = "mygmail@gmail.com"; final String password = "mygmailpassword"; Properties props = new Properties(); …
user962206
  • 13,699
  • 56
  • 164
  • 259
58
votes
11 answers

GoDaddy SSL Cert Not Working With Java

UPDATE 1/26/2015 -- It appears the most recent JRE/JDK for Java 8 (update >= 31) and JRE/JDK for Java 7 now include the Godaddy G2 CA server in the default trust store. If possible, it's urged you upgrade your JRE/JDK to the latest Java 8 update to…
SnakeDoc
  • 11,211
  • 13
  • 56
  • 86
57
votes
5 answers

UTF-8 charset doesn't work with javax.mail

I have used Java Mail API, for sending emails. I am using a contact formular to send the input, which has to be send to a specific email. The email is send without problems, though I am a danish guy, and I am therefore in need of three danish…
Rohwedder
  • 1,483
  • 4
  • 18
  • 31
52
votes
1 answer

Where to find all available Java mail properties?

Where do I find a list of all available Java mail properties that I can pass to the Session object? I am only able to find basic properties in the API. Browsing blogs to find some more properties isn't good. There must be some list somewhere?
LuckyLuke
  • 42,935
  • 77
  • 254
  • 416
1
2 3
99 100