apache-commons-email

Sending email with java Apache Commons Mail through Lotus Notes

て烟熏妆下的殇ゞ 提交于 2020-01-04 03:53:20
问题 I'm having trouble with my e-mail configuration for sending e-mails using lotus notes in a java program. I know this is pretty much straight forward but i guess i'm missing something. My code is as follows; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.commons.mail.EmailException; import org.apache.commons.mail.SimpleEmail; public class MailClass { public void SendMail() { SimpleEmail email = new SimpleEmail(); try { email.setHostName("mail.smtp.host");

Error in sending email using commons-email-1.3

末鹿安然 提交于 2019-12-31 02:13:24
问题 While sending email I am getting the following errors using commons-email-1.3. I have downloaded and added external jar's to the project. Please help me fix this problem! package mypkg; import org.apache.commons.mail.DefaultAuthenticator; import org.apache.commons.mail.Email; import org.apache.commons.mail.SimpleEmail; public class sendingmail { public static void main(String[] args) throws Exception { Email email = new SimpleEmail(); email.setSmtpPort(587); email.setAuthenticator(new

OSGi GWT org.apache.commons.mail.EmailException

天大地大妈咪最大 提交于 2019-12-25 10:05:13
问题 I have an OSGi application which has a command line interface and a GWT interface. I have a separate bundle that is responsible for sending emails. It uses Apache Commons Email. The email bundle only provides one method for sending email and all of the properties are hard coded at the moment. When I send the email from the command line, it gets a reference to the bundle and sends off the email with no problem. When I send the email from the GWT interface, it gets a reference to the bundle and

Sending email in Java using Apache Commons email libs

浪尽此生 提交于 2019-12-20 08:30:54
问题 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 = {"receiver@gmail.com"}; SimpleEmail email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setAuthentication("sender@gmail.com", "mypasswd"); email.setDebug(true); email.setSmtpPort(465); for (int i = 0; i < recipients

How to send multiple emails in one session?

人走茶凉 提交于 2019-12-18 22:35:36
问题 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

Why is this URL not opened from Play! Framework 1.2.4?

不羁岁月 提交于 2019-12-11 02:41:27
问题 I have a URL in my Play! app that routes to either HTML or XLSX depending on the extension that is passed in the URL, with a routes line like :- # Calls GET /calls.{format} Call.index so calls.html renders the page, calls.xlsx downloads an Excel file (using Play Excel module). All works fine from the browser, a cURL request, etc. I now want to be able to create an email and have the Excel attached to it, but I cannot pull the attachment. Here's the basic version of what I tried first :-

Apache Commons Email and UTF-8

笑着哭i 提交于 2019-12-08 15:59:07
问题 How do you change the encoding of an email generated with Apache Commons Email to UTF-8? I want to send emails I generate depending on the receiver's language, and I need to take in account Japanese and Russian. Problem is: the Email class doesn't propose a UTF-8 constant I can pass to the Email.setCharset method. Any clue? 回答1: There does appear to be a constant for UTF_8 in the Apache Commons Email API: UTF_8 static final String UTF_8 See Also: Constant Field Values All Known Implementing

Sending an Email Using Commons-Email to Gmail

北城以北 提交于 2019-12-04 11:37:42
问题 Email email = new SimpleEmail(); String authuser = "......@gmail.com"; 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"); email.getMailSession().getProperties().put("mail.smtp.auth", "true"); email.getMailSession().getProperties().put("mail.debug", "true"); email.getMailSession()

Sending email in Java using Apache Commons email libs

北慕城南 提交于 2019-12-02 16:00:39
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 = {"receiver@gmail.com"}; SimpleEmail email = new SimpleEmail(); email.setHostName("smtp.gmail.com"); email.setAuthentication("sender@gmail.com", "mypasswd"); email.setDebug(true); email.setSmtpPort(465); for (int i = 0; i < recipients.length; i++) { email.addTo(recipients[i]); } email.setFrom("sender@gmail.com", "Me"); email.setSubject(

Apache Commons Email encode attach with base64

独自空忆成欢 提交于 2019-12-01 19:38:29
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(new ByteArrayDataSource( Base64.encodeBase64(attachFull.getBytes()), "text/plain"), "samplefile.txt",