on 05-21-2008 10:44 AM
Hi,
I created an application to send mail. I would like my application to send mail to a specific recipient address that will always be the same. The problem is that the mail is never sent and I never get any errors. Here is my source code:
try {
// enter the mail host name here
String host = "10.139.16.13";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Setup authentication, get session
Authenticator auth = new PopupAuthenticator();
//Session session = Session.getInstance(props, auth);
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
Address fromAddress = new InternetAddress("address at address.com", "From me");
Address toAddress = new InternetAddress("address at address.com");
message.setFrom(fromAddress);
message.addRecipient(Message.RecipientType.TO,toAddress);
message.setSubject("Notification");
message.setText(wdContext.currentPopupNodeElement().getUserRequest());
// Send message
Transport.send(message);
} catch (Exception e) {
System.out.println("Exception while sending mail" + e.getMessage());
e.printStackTrace();
}
Any idea ?
Thanks for your help...
Thibault
Sorry I found the solution on an other thread.
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did you checked the log for any errors
catch (Exception e) {
System.out.println("Exception while sending mail" + e.getMessage());
e.printStackTrace();
Or else add the following line in your exception handler and check whether their is any error or not.
wdComponentAPI.getMessageManager().reportException(e.getMessage());
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.