commons-email

Sending email in Java using Apache Commons email libs

I am using Apache Commons Email library to send emails, but I am not able to send them via GMail SMTP server. Can anyone provide sample code which works with GMail SMTP server and others? I am using the following code which does not work: String[] recipients = {"[email protected]"}; SimpleEmail email = new SimpleEmail(); email.setHos...

How to attach a file to an HTML email using apache commons email

I'm using Apache Commons Email 1.1 and I can't figure out how to attach a file to an HtmlEmail. If I run the code below, I get an email with an attachment, but the html message comes across as an attachment also. If I don't call email.attach() the html message come through as you would expect, but I need both the html message to come t...

Sending an Email Using Commons-Email to Gmail

Email email = new SimpleEmail(); String authuser = "[email protected]"; String authpwd = "*******"; // Very Important, Don't use email.setAuthentication() email.setSmtpPort(465); email.setAuthenticator(new DefaultAuthenticator(authuser, authpwd)); email.setDebug(true); // true if you want to debug email.setHostName("smtp.gmail.com"); ema...

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

Hi, 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 Notes). One user have even analysed the problem and sent me the following link: http://sup...

Using apache commons email library getting error must issue a starttls command first. Please help

Email email = new SimpleEmail(); String authuser = "[email protected]"; String authpwd = "*******"; // Very Important, Don't use email.setAuthentication() email.setSmtpPort(587); email.setAuthenticator(new DefaultAuthenticator(authuser, authpwd)); email.setDebug(true); // true if you want to debug email.setHostName("smtp.gmail.com"); ema...

Java mail attachment not working on Tomcat

Hello guys, I have an application which e-mails confirmations. The email part utilises Commons Mail API. The simple code which does the send mail is as shown below; import org.apache.commons.mail.*; ... // Create the attachment EmailAttachment attachment = new EmailAttachment(); attachment.setURL(new URL("http://cashew.org/doc.pdf")); ...

Java:Apache commons mail goes immediately to hotmail junk folder

Hello all Is there a way to make my email pass through these hotmail filters? In gmail the mails arrive in the inbox folder ...

Unable to send email in Servlet via commons-email and JavaMail

I've written a small web app in Java. It sends out mail via the Jakarta Commons SimpleEmail class. I've tried JavaMail and I've gotten the same result. The code works on my local copy of Tomcat, but it fails when I deploy it to any test server. Further, I can telnet to the SMTP relay from all of the servers I've tested this on. I've...

html email with attachment

I'm attempting to include a zip attachment with some html content in an email using apache-commons-email 1.1. If i use this code, which sends an email without an attachment, the html body displays correctly. HtmlEmail email = new HtmlEmail(); email.setMailSession(mailSession); email.setSubject(subject); email.addTo(to); email.setFrom(f...