apache-commons-email

Apache Commons Email encode attach with base64

时光总嘲笑我的痴心妄想 提交于 2019-12-01 19:00:12
问题 I'm trying to send a file base64-encoded via apache.commons.mail and I just can't seam to get the Content-Transfer-Encoding: base64 header where it's supposed to go. // Create the email MultiPartEmail email = new MultiPartEmail(); email.setSmtpPort(587); email.setDebug(false); email.setHostName("smtp.gmail.com"); email.setAuthentication("from@gmail.com", "password"); email.setTLS(true); email.addTo("to@example.com"); email.setFrom("from@example.com"); email.setSubject("subject"); email.attach

How to send multiple emails in one session?

这一生的挚爱 提交于 2019-11-30 19:26:02
I want to send thousands of different emails to different recipients and would like to open the connection to my SMTP and hold it. I hope this is faster then reopen the connection for ervy mail. I would like to use Apache Commons Email for that, but could fall back to the Java Mail API if necessary. Right now I'am doing this, what opens a closes the connection every time: HtmlEmail email = new HtmlEmail(); email.setHostName(server.getHostName()); email.setSmtpPort(server.getPort()); email.setAuthenticator(new DefaultAuthenticator(server.getUsername(), server.getPassword())); email.setTLS(true)