Skip to Content
author's profile photo Former Member
Former Member

Mail Service Activation

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2009 at 06:23 AM

    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]

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2009 at 05:54 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2009 at 05:55 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.