on 08-11-2009 6:26 AM
Hi Experts,
What are the service and jar files required to run mail service application. I deployed one application but mailing is not working..
What are codes required to do so????....
Please share some links.
Thanks
Nitu
Hi
you can you this sample code, which is working in java.
try {
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", SMTP_HOST_NAME);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "26");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(true);
MimeMessage message = new MimeMessage(session);
message.setSubject("Testing javamail plain");
message.setContent("This is a test", "text/plain");
message.setFrom(new InternetAddress("from@something"));
message.setRecipient(
Message.RecipientType.TO,
new InternetAddress("to@something"));
Transport transport = session.getTransport();
//Transport.send(message);
transport.connect();
transport.sendMessage(
message,
message.getRecipients(Message.RecipientType.TO));
transport.close();
} catch (MessagingException exc) {
exc.printStackTrace(out);
} catch (RuntimeException exc){
exc.printStackTrace(out);
}
For more check this link
[Implementing Email function.|http://fisheye5.cenqua.com/browse/glassfish/mail/src/java/com/sun/mail/smtp/SMTPTransport.java?r=1.13#l38*This]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you added mail.jar file to you application and classpath?
If possible run through the FAQ's on Java Mail API here - http://java.sun.com/products/javamail/FAQ.html
Thanks,
GLM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.