Re: [jira] Commented: (GERONIMO-2593) Document Javamail Session creation and usage
David Jencks (JIRA) wrote: [ http://issues.apache.org/jira/browse/GERONIMO-2593?page=comments#action_12458852 ] David Jencks commented on GERONIMO-2593: This suggests a couple of wish-list ideas: -- a JAMES plugin for geronimo -- turning this into a testsuite functional test Any ideas on how hard it might be to do these? I'm not sure how hard it would be to do that, but James unfortunately doesn't support all of the things we'd actually like to test with something like that (such as different authentication types). It also has a few bugs I tripped over trying to test things like the NNTP support. Rick thanks david jencks Document Javamail Session creation and usage Key: GERONIMO-2593 URL: http://issues.apache.org/jira/browse/GERONIMO-2593 Project: Geronimo Issue Type: Improvement Security Level: public(Regular issues) Components: documentation Affects Versions: 1.1.1 Environment: WAS CE 1.1.0.1 Reporter: Mike Perham Attachments: sendmail.jpg, sendmail.war I can't find anywhere in the GDOC11 wiki or WAS CE public documentation that explains how to create a simple system-wide mail Session. The Geronimo console does not have a page to create them and the samples only contain a single "javamail" config project whose plan.xml is incomprehensible to a mere mortal like me. Please provide an example how to create a mail Session (or how to get one out of the javamail module configured in config.xml?) and how to reference that session within a webapp. If anyone sees this issue and can email me an example, please email mike AT perham.net. I'm stuck on this right now.
[jira] Commented: (GERONIMO-2593) Document Javamail Session creation and usage
[ http://issues.apache.org/jira/browse/GERONIMO-2593?page=comments#action_12458852 ] David Jencks commented on GERONIMO-2593: This suggests a couple of wish-list ideas: -- a JAMES plugin for geronimo -- turning this into a testsuite functional test Any ideas on how hard it might be to do these? thanks david jencks > Document Javamail Session creation and usage > > > Key: GERONIMO-2593 > URL: http://issues.apache.org/jira/browse/GERONIMO-2593 > Project: Geronimo > Issue Type: Improvement > Security Level: public(Regular issues) > Components: documentation >Affects Versions: 1.1.1 > Environment: WAS CE 1.1.0.1 >Reporter: Mike Perham > Attachments: sendmail.jpg, sendmail.war > > > I can't find anywhere in the GDOC11 wiki or WAS CE public documentation that > explains how to create a simple system-wide mail Session. The Geronimo > console does not have a page to create them and the samples only contain a > single "javamail" config project whose plan.xml is incomprehensible to a mere > mortal like me. > Please provide an example how to create a mail Session (or how to get one out > of the javamail module configured in config.xml?) and how to reference that > session within a webapp. > If anyone sees this issue and can email me an example, please email mike AT > perham.net. I'm stuck on this right now. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (GERONIMO-2593) Document Javamail Session creation and usage
[ http://issues.apache.org/jira/browse/GERONIMO-2593?page=comments#action_12458730 ] Christopher M. Cardona commented on GERONIMO-2593: -- Hi Mike, Hope this helps. chris {color:red} Using Geronimo's default JavaMail session: {color} Note: This was tested on trunk and should be the same steps for Geronimo v1.2 and v2.0 with minor changes specifically references to JavaMail module ID. 1. Download Apache JAMES from: http://apache2.openmirrors.org/james/server/binaries/james-2.3.0.zip 2. Unzip file and run JAMES by executing: \james-2.3.0\bin\run.bat. You should see something like this: {code:xml} Phoenix 4.2 James Mail Server 2.3.0 Remote Manager Service started plain:4555 POP3 Service started plain:110 SMTP Service started plain:25 NNTP Service started plain:119 FetchMail Disabled {code} 3. Make sure JavaMail module is started: - For trunk and v2.0-M1: org.apache.geronimo.configs/javamail/2.0-SNAPSHOT/car (by default this is started) - For v1.2-beta: org.apache.geronimo.configs/javamail/1.2-beta/car (by default this is not started) - To start the module you can: a. Use the Web Console: Applications > System Modules > Click 'Start' link beside the JavaMail module ID b. Use command line deployer: {code:xml} cd \bin java -jar deployer.jar --user system --password manager start org.apache.geronimo.configs/javamail/2.0-SNAPSHOT/car {code} c. Stop the server. Modify \var\config\config.xml and set JavaMail module load attribute to 'true': {code:xml} ... localhost 25 ... {code} Note: You can configure the SMTP transport's host and port by overriding the values of the SMTPTransport GBean attrbitues. For our test we will use the default. This will allow us to connect to JAMES running in localhost and using port 25 (the default SMTP port). 3. Create a simple webapp (sendmail.war - attached in this issue) containing the following files: {code:xml} sendmail.war + index.jsp + WEB-INF + web.xml + geronimo-web.xml {code} web.xml: {code:xml} http://java.sun.com/xml/ns/j2ee"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4"> Send Mail Webapp index.jsp mail/testMailSession javax.mail.Session Container Shareable {code} geronimo-web.xml: {code:xml} http://geronimo.apache.org/xml/ns/j2ee/web-1.1";> test sendmail 1.0 car org.apache.geronimo.configs javamail 2.0-SNAPSHOT car /sendmail mail/testMailSession mail/MailSession {code} index.jsp: {code:xml} <[EMAIL PROTECTED] import="java.util.Date, javax.mail.Message, javax.mail.Session, javax.mail.Transport, javax.mail.internet.InternetAddress, javax.mail.internet.MimeMessage, javax.naming.InitialContext" %> <% String resultMsg = ""; String action = request.getParameter("action"); if ("Send".equals(action)) { String from = request.getParameter("from"); String to = request.getParameter("to"); String subject = request.getParameter("subject"); String content = request.getParameter("message"); // Get mail session and transport InitialContext context = new InitialContext(); // Mail session from web.xml's resource reference Session mailSession = (Session) context.lookup("java:comp/env/mail/testMailSession"); Transport transport = mailSession.getTransport("smtp"); // Setup message MimeMessage message = new MimeMessage(mailSession); // From address message.setFrom(new InternetAddress(from)); // To address message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); // Subject message.setSubject(subject); // Content message.setText(content); // Send message transport.connect(); transport.send(message); // Build result message resultMsg = "Result:"; resultMsg += "Message sent: " + new Date(); resultMsg += "To: " + to; resultMsg += "From: " + from; } %> Send Mail Send Mail From: To: Subject:
[jira] Commented: (GERONIMO-2593) Document Javamail Session creation and usage
[ http://issues.apache.org/jira/browse/GERONIMO-2593?page=comments#action_12458732 ] Christopher M. Cardona commented on GERONIMO-2593: -- Hernan, Maybe we can include this in our docs so we have basic documentation for JavaMail. I don't mind doing it but not sure where to put it. :-) Thanks, chris > Document Javamail Session creation and usage > > > Key: GERONIMO-2593 > URL: http://issues.apache.org/jira/browse/GERONIMO-2593 > Project: Geronimo > Issue Type: Improvement > Security Level: public(Regular issues) > Components: documentation >Affects Versions: 1.1.1 > Environment: WAS CE 1.1.0.1 >Reporter: Mike Perham > Attachments: sendmail.jpg, sendmail.war > > > I can't find anywhere in the GDOC11 wiki or WAS CE public documentation that > explains how to create a simple system-wide mail Session. The Geronimo > console does not have a page to create them and the samples only contain a > single "javamail" config project whose plan.xml is incomprehensible to a mere > mortal like me. > Please provide an example how to create a mail Session (or how to get one out > of the javamail module configured in config.xml?) and how to reference that > session within a webapp. > If anyone sees this issue and can email me an example, please email mike AT > perham.net. I'm stuck on this right now. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira