Unable to send emails from the plugin
Oxygen general issues.
-
- Posts: 7
- Joined: Wed Aug 21, 2013 3:33 pm
Unable to send emails from the plugin
Hi guys,
I am developing plugin for Oxygen editor.
Among other things it requires email sending form the plugin code.
I created email sending logic based on java mail api. It works fine when I run it from the unit test.
Once I wrap this email sending logic into the plugin and start Oxygen the email is not getting sent, no error messages, just silence.
I use smtp.jar, mail.jar and mailapi.jar in the class path
Am I missing something?
Please help!
I am developing plugin for Oxygen editor.
Among other things it requires email sending form the plugin code.
I created email sending logic based on java mail api. It works fine when I run it from the unit test.
Once I wrap this email sending logic into the plugin and start Oxygen the email is not getting sent, no error messages, just silence.
I use smtp.jar, mail.jar and mailapi.jar in the class path
Am I missing something?
Please help!
-
- Posts: 9445
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Unable to send emails from the plugin
Hi,
So you added those required JAR libraries to the plugin.xml, right?
If you start Oxygen using the oxygen.bat command line executable, is there any error reported in the console?
If you wrap all your code in a
is there any exception stack trace reported in the console?
By the way, we have a topic which explains how you could test your plugin with Oxygen as a JUnit test case:
http://www.oxygenxml.com/doc/ug-oxygen/ ... tests.html
Regards,
Radu
So you added those required JAR libraries to the plugin.xml, right?
If you start Oxygen using the oxygen.bat command line executable, is there any error reported in the console?
If you wrap all your code in a
Code: Select all
try{
}catch(Exception ex){
ex.printStackTrace();
}
By the way, we have a topic which explains how you could test your plugin with Oxygen as a JUnit test case:
http://www.oxygenxml.com/doc/ug-oxygen/ ... tests.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 7
- Joined: Wed Aug 21, 2013 3:33 pm
Re: Unable to send emails from the plugin
Yep,
I wrapped it up with try/catch. No errors detected but the email is not getting sent.
here is my email sending code
Properties properties = System.getProperties();
properties.put("mail.smtp.host", "smtp.gmail.com");
properties.put("mail.smtp.port", 587);
properties.put("mail.smtp.user", "XXX@gmail.com");
properties.put("mail.smtp.auth", true);
properties.put("mail.smtp.timeout", 60000);
properties.put("mail.smtp.starttls.enable", true);
Session session = Session.getInstance(properties,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("XXX@gmail.com", "ZZZ");
}
});
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress("my@gmail.com"));
message.addRecipients(Message.RecipientType.TO, "yours@gmail.com");
message.setSubject("Subject");
message.setText("Email message!");
Transport.send(message);
I wrapped it up with try/catch. No errors detected but the email is not getting sent.
here is my email sending code
Properties properties = System.getProperties();
properties.put("mail.smtp.host", "smtp.gmail.com");
properties.put("mail.smtp.port", 587);
properties.put("mail.smtp.user", "XXX@gmail.com");
properties.put("mail.smtp.auth", true);
properties.put("mail.smtp.timeout", 60000);
properties.put("mail.smtp.starttls.enable", true);
Session session = Session.getInstance(properties,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("XXX@gmail.com", "ZZZ");
}
});
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress("my@gmail.com"));
message.addRecipients(Message.RecipientType.TO, "yours@gmail.com");
message.setSubject("Subject");
message.setText("Email message!");
Transport.send(message);
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service