You can enable your J2EE applications to use mail resources with the JavaMail API.
javax.naming.InitialContext ctx = new javax.naming.InitialContext(); javax.mail.Session mail_session = (javax.mail.Session) ctx.lookup("java:comp/env/mail/MailSession3"); MimeMessage msg = new MimeMessage(mail_session); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("bob@coldmail.net")); msg.setFrom(new InternetAddress("alice@mail.eedge.com")); msg.setSubject("Important message from eEdge.com"); msg.setText(msg_text); Transport.send(msg); Store store = mail_session.getStore(); store.connect(); Folder f = store.getFolder("Sent"); if (!f.exists()) f.create(Folder.HOLDS_MESSAGES); f.appendMessages(new Message[] {msg});
In this information ...Subtopics
| IBM Redbooks, demos, education, and more |