[
https://issues.apache.org/jira/browse/EMAIL-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thomas Neidhart resolved EMAIL-157.
-----------------------------------
Resolution: Cannot Reproduce
> Sending an email from a Java TimerTask object doesn't work
> ----------------------------------------------------------
>
> Key: EMAIL-157
> URL: https://issues.apache.org/jira/browse/EMAIL-157
> Project: Commons Email
> Issue Type: Bug
> Affects Versions: 1.4
> Environment: OS: Windows 8.1 Pro / IDE: Eclipse Juno / Servlets
> container: Tomcat 8
> Reporter: LEA MASSIOT
>
> Hello,
> I'm using "Apache Commons Email 1.4".
> Consider the following simple code:
> {code}
> import org.apache.commons.mail.Email;
> import org.apache.commons.mail.EmailException;
> import org.apache.commons.mail.SimpleEmail;
> [...]
> Email email = new SimpleEmail();
> email.setHostName("smtp.foo.bar");
> try
> {
> email.setFrom("[email protected]");
> email.setSubject("TestMail");
> email.setMsg("This is a test mail ... :-)");
> email.addTo("[email protected]");
> email.send();
> }
> catch(EmailException e)
> {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> {code}
> The code above is put:
> - CASE 1: in the *doPost()* method of a *HttpServlet* object: it works (I
> receive the email).
> - CASE 2: at runtime (there are no build errors), in the *run()* method of a
> *TimerTask* object:
> If I put a breakpoint on the line *Email email = new SimpleEmail();*
> hit F6 in Eclipse to execute the instruction,
> I get the message: Source not found.
> What am I doing wrong? What is going wrong? How can I make it work?
> Best regards.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)