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:

5196 questions
57
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
  • 47,771
  • 85
  • 270
  • 434
53
votes
7 answers

Java mail sender's address displayed rather than his name

I am trying to send mail to my friends through my Java Mail application. I am able to do it successfully however the receiver's column in the mailbox shows the complete email address rather than the name of the sender. I tried changing various…
Nelo Angelo
  • 977
  • 3
  • 11
  • 16
52
votes
7 answers

Using JavaMail with TLS

I found several other questions on SO regarding the JavaMail API and sending mail through an SMTP server, but none of them discussed using TLS security. I'm trying to use JavaMail to send status updates to myself through my work SMTP mail server,…
dancavallaro
  • 13,109
  • 8
  • 37
  • 33
51
votes
4 answers

Setting the from name in a javax.mail.MimeMessage?

Currently, our application uses a javax.mail to send email, using javax.mail.MailMessage. We set the From headers of the email this way: Message msg = new MimeMessage(mailSession); msg.setFrom(new InternetAddress("mail@companyxyz.com")); This works…
abeger
  • 6,766
  • 7
  • 41
  • 58
50
votes
7 answers

Base64: java.lang.IllegalArgumentException: Illegal character

I'm trying to send a confirmation email after user registration. I'm using the JavaMail library for this purpose and the Java 8 Base64 util class. I'm encoding user emails in the following way: byte[] encodedEmail =…
marknorkin
  • 3,904
  • 10
  • 46
  • 82
47
votes
6 answers

How to get the list of available folders in a mail account using JavaMail

I am using JavaMail API to connect to my personal account. I have list of folders (labels) in my Gmail account which I created + the default folders like Inbox, Drafts etc. How can I list all the available folders (the default and the user created)?…
Jagadesh
  • 6,489
  • 8
  • 29
  • 30
47
votes
1 answer

JavaMail API from Maven

I am trying to upgrade to latest Java Mail utility. From javax.mail mail 1.4.7 to (my Intention) javax.mail
Kumar
  • 1,106
  • 4
  • 15
  • 33
44
votes
7 answers

Postfix and OpenJDK 11: "No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"

I know there are some other questions (with answers) to this topic. But none of these was helpful for me. I have a Postfix server (postfix 3.4.14 on Debian 10 (Buster)) with the following configuration (only the interesting…
Steffen
  • 2,500
  • 4
  • 31
  • 47
44
votes
14 answers

How to attach multiple files to an email using JavaMail?

The following Java code is used to attach a file to an email. I want to send multiple files attachments through email. Any suggestions would be appreciated. public class SendMail { public SendMail() throws MessagingException { String…
lakshmi
  • 4,539
  • 17
  • 47
  • 55
44
votes
18 answers

Solve error javax.mail.AuthenticationFailedException

I'm not familiar with this function to send mail in java. I'm getting an error while sending email to reset a password. Hope you can give me a solution. Below is my code: public synchronized static boolean sendMailAdvance(String emailTo, String…
Fatin Az
  • 509
  • 2
  • 6
  • 8
37
votes
8 answers

How to set MimeBodyPart ContentType to "text/html"?

The program below shows an unexpected return value for HTML multipart MIME type. Why does this program print text/plain and not text/html? public class Main { public static void main(String[] args) throws javax.mail.MessagingException,…
necromancer
  • 23,916
  • 22
  • 68
  • 115
37
votes
4 answers

Amazon Simple Email Service (SES) - Should I use SMTP Interface or SES API?

I'm new to Amazon SES and I see that there are two ways to programmatically send emails: SES API (http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-api.html) SES SMTP Interface…
AlexG
  • 1,596
  • 2
  • 17
  • 26
37
votes
6 answers

Retrieving all unread emails using javamail with POP3 protocol

I am trying to access my gmail account and retrieve the information of all unread emails from that. I have written my code after referring many links. I am giving a few links for reference. Send & Receive emails through a GMail account using…
MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
36
votes
10 answers

javamail mark gmail message as read

Note: added after answer: Thanks.. Yeah I had tried the Flag.SEEN to true and saveChanges.. I also had read getContent marks it read. I tried using it in the for statement that loops through the messages. But I got the messages again from the…
Green
  • 1,405
  • 4
  • 21
  • 27
34
votes
6 answers

Error in JavaMail : PKIX path building failed unable to find valid certification path to requested target

I am trying to build an email client app in android and right now i want to configure the javaMail part. i am trying to establish the connection with the imap server but something is wrong with my code.. here is my code: package mailpackage; import…
fnkbz
  • 1,189
  • 1
  • 12
  • 22