I am having trouble understanding how to set up the smtp property. I do not have
internet connection now. I wanted to use my Outlook or something. What do I do
to get Glassfish to generate emails so I can begin learning how to code my app to
send emails by gathering props and properties from my db?

//java mail inserted
        String smtpServer = "model.mail.SimpleSender";
        String to = "cisumma@hotmail.com";
        String from = "cisumma@hotmail.com";
        String subject = "Hello Mail World subject";
        String body = "Hello Mail World body";
        SimpleSender ss = new SimpleSender();
        ss.send(smtpServer, to, from, subject, body);
        //java mail inserted
Member Avatar for ztini

Apache's James server will probably meet your requirements. This is an open source email server that supports SMTP/POP3/NNTP. It is built upon the javax.mail package and complies (for the most part) with RFC2822, the commonly accepted emails standard.

http://james.apache.org/

Once you have James up and running, you can send emails using the SMTP protocol from your application to James. This is simply a matter of opening a socket on port 25.

http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

I've used this approach with much success in the past to solve small scale SMTP/POP3 integration with my applications.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.