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
34
votes
7 answers

java.lang.NoClassDefFoundError: javax/mail/Authenticator, whats wrong?

Send to Email.java package helper; //Mail.java - smtp sending starttls (ssl) authentication enabled //1.Open a new Java class in netbeans (default package of the project) and name it as "Mail.java" //2.Copy paste the entire code below and save…
bluestella
  • 389
  • 1
  • 4
  • 8
33
votes
5 answers

Is there a work around google disabling "Less secure apps"?

So since the 31 of may google has disabled the option for "Less secure apps", so I have been using the Java mail API, and since the update i can no longer send emails using the Gmail smtp. This is the error I'm…
Soske
  • 541
  • 1
  • 4
  • 10
33
votes
8 answers

Inline images in email using JavaMail

I want to send an email with an inline image using javamail. I'm doing something like this. MimeMultipart content = new MimeMultipart("related"); BodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(message, "text/html;…
akula1001
  • 4,576
  • 12
  • 43
  • 56
33
votes
3 answers

Using Javamail to connect to Gmail smtp server ignores specified port and tries to use 25

I'm trying to use javamail in a groovy script to send out an email via gmail. I've looked many places online and have been unable to get it working thus far. The error I'm getting when running my script is: DEBUG SMTP: useEhlo true, useAuth…
Bryan
  • 1,431
  • 1
  • 14
  • 19
33
votes
2 answers

Send mail in javax.mail without authentication

I am using javax.mail to send mails in Java. Now that a part of the concept of my project changed I have to send a mail without authentication. I will have to change my createSession() method: private void createSession() { …
muffin
  • 1,456
  • 4
  • 21
  • 44
32
votes
5 answers

Problem with subject encoding when sending an email

I'm sending an email and I'm receiving it correctly but the encoding of the subject is not correct. I'm sending "invitación" but I'm receiving "invitaci?n". The content of the message is OK. The content of the message is coming from a…
Javi
  • 19,387
  • 30
  • 102
  • 135
31
votes
9 answers

JavaMail with Gmail: 535-5.7.1 Username and Password not accepted

I am receiving error when I try to send a mail using JavaMail API and I am sure that the username and password are 100% correct. The Gmail account which I'm connecting is an older account, because they say it takes time for it to work with new…
simplyblue
  • 2,279
  • 8
  • 41
  • 67
31
votes
13 answers

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary

Currently I'm inline of writing a code that will be listening to a directory. when the directory is updated with .apk file, I'll send a mail with this .apk file to a gmail account. I'm using Jnotify and JAVA Mail in my program. The Error I'm getting…
Vidhee
  • 777
  • 1
  • 6
  • 14
31
votes
1 answer

Best Practices - Sending javamail mime multipart emails - and gmail

I have a Tomcat application that needs to send confirmation emails etc. I have coded the emailer with Javamail (mail.jar) to send multipart text/html emails. I based the code on the Java EE examples. I'm using the SMTP MTA on the local server. It…
PrecisionPete
  • 3,139
  • 5
  • 33
  • 52
30
votes
8 answers

JavaMail sending mail attachment from string - encoding UTF-8

My application has to send a textfile, which it first has to generate as a String. The text contains non-ASCII symbols, so i would like it to be UTF-8. I've tried a lot of variants, but all i receive as the attachment is some question marks. And,…
Ibolit
  • 9,218
  • 7
  • 52
  • 96
30
votes
4 answers

IMAP client in Java: JavaMail API or Apache Commons Net?

I have to implement an IMAP Client in Java. Which advantages has using the Apache Commons Net library? Does it make the implementation robust and more flexible? How do I have to handle return values, it always produces strings. For example: public…
benchpresser
  • 2,171
  • 2
  • 23
  • 41
30
votes
7 answers

The Jar of this class file belongs to container 'Android Dependencies' which does not allow modifications to source attachments on its entries

I am making an email application which is giving the error in this question's title. How can I fix this problem? I am giving my codes screenshot if it is helps to find solution.
Merve Gül
  • 1,377
  • 6
  • 23
  • 40
29
votes
6 answers

Illegal access: this web application instance has been stopped already

I have a class which has an init-method defined in xml myClass: public class myClass{ private Thread t; public void init() { t =…
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
27
votes
11 answers

how to ignore server cert error in javamail

when i connect to my imap server using imaps,it failes. can you tell me how to ignore server cert error in javamail Exception in thread "main" javax.mail.MessagingException: sun.security.validator.ValidatorException: PKIX path building…
ncowboy
  • 1,311
  • 2
  • 13
  • 19
27
votes
2 answers

Threadsafety in Javamail

I'm researching whether Javamail is threadsafe, in particular in a situation with many sessions corresponding to different users, several SMTP servers and the use of creating MIME messages and use of transport.sendMessage method. I know Javamail is…
djechlin
  • 59,258
  • 35
  • 162
  • 290