Tomcat has this nice feature called Resource mail/Session. Without this feature, in your code, you get a mail session by:
Properties props = new Properties(); props.put("mail.smtp.host", "mysmtphost"); Session mailsession = Session.getDefaultInstance(props, null); With Tomcat's jndi lookup, you can get session by: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); Session session = (Session) envCtx.lookup("mail/Session"); But you still need to setup the sending params, such as Message m = new MimeMessage(session); m.setFrom("sender"); m.addRecipient(Message.RecipientType.TO, "recipient"); m.setSentDate("date"); m.setSubject("subject"); m.setText("text"); Transport.send(m); -----Original Message----- From: Clement [mailto:[EMAIL PROTECTED] Sent: June 6, 2003 11:30 PM To: Tomcat Users List Subject: Re: Tomcat configuring for email Hello. Sorry for the confusion. What i meant does tomcat have a built in emailing? As u replied there is . But is it on by default? when i try running the example inside , it seems to be a dummy one. What i am trying to do is to mail a user automatically everytime he makes a purchase. inside the default server.xml as shown below, is this the way to enable emailing or is there more to it? Thanks.. <Environment name="maxExemptions" type="java.lang.Integer" value="15"/> <Parameter name="context.param.name" value="context.param.value" override="false"/> <Resource name="jdbc/computersDB" auth="SERVLET" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/computersDB"> <parameter><name>user</name><value>sa</value></parameter> <parameter><name>password</name><value></value></parameter> <parameter><name>driverClassName</name> <value>org.hsql.jdbcDriver</value></parameter> <parameter><name>driverName</name> <value>jdbc:HypersonicSQL:database</value></parameter> </ResourceParams> <Resource name="mail/Session" auth="Container" type="javax.mail.Session"/> <ResourceParams name="mail/Session"> <parameter> <name>mail.smtp.host</name> <value>localhost</value> </parameter> </ResourceParams> </Context> ----- Original Message ----- From: "Phillip Qin" <[EMAIL PROTECTED]> To: "'Tomcat Users List'" <[EMAIL PROTECTED]> Sent: Friday, June 06, 2003 23:17 Subject: RE: Tomcat configuring for email > Don't understand your question. Tomcat has built-in mail session jndi > lookup. You can use it in your program. Is that what you want? > > -----Original Message----- > From: Clement [mailto:[EMAIL PROTECTED] > Sent: June 6, 2003 2:53 AM > To: Tomcat Users List > Subject: Tomcat configuring for email > > Hello... > I would like to check with for emailing purposes.. how do i enable > tomcat to send an email to a user? Can version 4.01 do this or do u need a > newer version? ? > Thanks.. > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]