Questions tagged [apache-commons-email]

Apache Commons Email aims to provide a API for sending email. It is built on top of the Java Mail API, which it aims to simplify.

Apache Commons Email aims to provide a API for sending email. It is built on top of the Java Mail API, which it aims to simplify.

Some of the mail classes that are provided are as follows:

  • SimpleEmail - This class is used to send basic text based emails.
  • MultiPartEmail - This class is used to send multipart messages. This allows a text message with attachments, either inline or attached.
  • HtmlEmail - This class is used to send HTML formatted emails. It has all the capabilities of MultiPartEmail, allowing attachments to be easily added. It also supports embedded images.
  • ImageHtmlEmail - This class is used to send HTML formatted emails with inline images. It has all the capabilities of HtmlEmail but transforms all image references to inline images.
  • EmailAttachment - This is a simple container class to allow for easy handling of attachments. It is for use with instances of MultiPartEmail and HtmlEmail.

Official Website: http://commons.apache.org/email/

Useful Links:

Related Tags:

86 questions
1
vote
1 answer

Attachments+Html generated with commons-email doesn't show in some email clients

I've been using the org.apache.commons.mail.HtmlEmail class, from apache commons-mail, for some time. Eventually, some users complain that the email shows with no attachemnts on their e-mail client (problem reported in Outlook 2007 and Lotus…
Jonathas Carrijo
  • 743
  • 2
  • 7
  • 14
1
vote
1 answer

Amazon AWS Simple Email Service: some email addresses NEVER receive emails

I have posted this question on the Amazon AWS Forums, but figured I might get a quicker, better answer here. I apologize if you see it twice. My company uses an Amazon AWS SMTP server to send emails via a Java-based web interface. This is just a…
Jeremy Goodell
  • 18,225
  • 5
  • 35
  • 52
1
vote
1 answer

configuring mock emails with commons-email

I have a project using commons-email ( http://search.maven.org/#artifactdetails|org.apache.commons|commons-email|1.2|jar ) through maven. I would like to use the email Mocks class (…
user833970
  • 2,729
  • 3
  • 26
  • 41
1
vote
1 answer

Apache FOP - PDF streamed to Commons Email Attachment

I'm using Apache Fop with XSL-FO to generate a PDF. I'm then trying to stream the pdf as an attachment to apache.commons.mail.HtmlEmail; I receive emails with the attachment, however I get the following error. Length 0 bytes, encoding none. I'm able…
Code Junkie
  • 7,602
  • 26
  • 79
  • 141
0
votes
1 answer

encoding between Axis2 and Apache Commons Email

I've got the following webservice method, which is called by REST: public boolean sendMail(String text) { Email email = new SimpleEmail(); email.setHostName(MAIL_SERVER); email.setSmtpPort(25); email.setAuthenticator(new…
Chris
  • 7,864
  • 1
  • 27
  • 38
0
votes
1 answer

Why SimpleMail Can not read eml file but java mail can

There is answer that gives an example to read eml file. I also found another example that uses plain java mail. Below is my code that attempts both. package mymailRead; import jakarta.mail.Session; import jakarta.mail.internet.MimeMessage; import…
puzzled
  • 509
  • 1
  • 5
  • 18
0
votes
0 answers

How To Fix NoClassDeFoundError com/sun/mail/util/PropUtil Exception NOT ClassNotFoundException: com.sun.mail.util.MailLogger?

I have a program that uses 2 Threads. These 2 threads work in cycle, meaning each thread waits for another thread to do the work than exits then another thread enter, do the work then exit. This happens over and over with a while loop. On each…
buraz
  • 19
  • 6
0
votes
0 answers

I have a Java NoClassDeFoundError com/sun/mail/util/PropUtil Exception not How can I fix ClassNotFoundException: com.sun.mail.util.MailLogger?

I have a program that uses 2 Threads. These 2 threads work in cycle, meaning each thread waits for another thread to do the work than exits then another thread enter, do the work then exit. This happens over and over with a while loop. On each…
rich25
  • 37
  • 11
0
votes
1 answer

Commons Email did not connect to correct host

I tried to connect to a remote mail server but somehow commons email/JavaMail always attempt to connect to localhost. Why??? Email email = new SimpleEmail(); email.setHostName("mailserver.com"); email.setSentDate(new Date()); …
yuejdesigner85
  • 115
  • 1
  • 1
  • 10
0
votes
2 answers

Java: Question regarding apache commons mail

I am trying to send an email using Apache commons Email API. I installed hMailServer as my smtp server and created a domain test.com. I added an user, 'user1' . I tried to send the mail using the below code public static void sendSimpleMail()…
user2434
  • 6,339
  • 18
  • 63
  • 87
0
votes
0 answers

Regression issue between org.apache.commons.commons-email and spark

Recently I've updated the version of org.apache.spark.spark-core and org.apache.spark.spark-sql to version 2.4.3 in my Scala application. Since then, my application is not able to send emails anymore. The library used for the email functionality is…
0
votes
1 answer

Forward an email(read using JavaMailApi) with Attachments by apache common java api

I'm reading messages from an Outlook webmail and getting a list of Messages('javax.mail.Message'). Now I want to forward these Messages to another email address using a java program. private void sendTestMail(String from, String subject, String…
0
votes
1 answer

HtmlEmail not rendering HTML correctly (apache commons)

Hoping that someone can find something I am missing. I am trying to send a simple HTML email within a java application. I am using commons-mail 1.1 (via maven) as my mail lib. The code I'm using is: HtmlEmail email = new…
rcurts
  • 45
  • 9
0
votes
0 answers

How can I keep the same permission of ssh key file while sending it through apache-common-email

I was struggling with this problem. I want to generate a ssh key by Jsch and send it through email. If I want to keep that private key file be able to use, I need to set the file permission, either way through setting PosixFilePermission or chmod…
Rionash
  • 29
  • 3
0
votes
0 answers

Send e-mail with a web application in Payara 5

I have a web application running on Payara 5 and when I try to send an email it gives the following error: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.gmail.com:587 at…