File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Problem sending mail using JSTL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem sending mail using JSTL" Watch "Problem sending mail using JSTL" New topic

Problem sending mail using JSTL

Arun Bommannavar
Ranch Hand

Joined: Jan 11, 2003
Posts: 53
I am trying to send e-mail using JSTL. I have "taglibs-mailer.jar" (Version 1.1) in webapps/myApp/WEB-INF/lib. I also have "activation.jar" and "mail.jar" in C:\j2sdk1.4.2_03\lib and they are in classpath.
In my JSP I have following lines of code:
taglib uri="" prefix="mt"
c:if test="${pageContext.request.method=='POST'}"
c:set var= "email" value= " '${param.e_mail}' "
mt:mail server="myServer" to="${email}" from="eMailAddress" subject="Test mail"

mt:message>This is a test </mt:message

The JSP itself doesn't show any error but the mail doesn't get delivered. I get an "Undeliverable mail" message from the server.
It says:
The following recipient(s) could not be reached:

How can I set a variable to the e-mail address and use that variable for sending the e-mail?
Thanks in advance.
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
Hmm. It looks to me as if you may be using the wrong "flavor" of JSTL.
JSTL comes in two types: one which expands ${expr} expressions in attribute text, and one which expands <%=expr%> expressions. You don't tell us which one you are using, so It might be worth trying the other form and see what happens.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Arun Bommannavar
Ranch Hand

Joined: Jan 11, 2003
Posts: 53
I didn't know about the two flavors of JSTL.
I downloaded the " " from "" site. After unzipping I get two files "jstl.jar" and "standard.jar". How do I find out which type is supported in this distribution?
Perhaps I am completely off track. Should I instead download "Java Web Services Developer Pack 1.3 " from Sun site? As I see from the description that this contains quite a few components and wasn't sure I need all that.
Thanks in advance.
I agree. Here's the link:
subject: Problem sending mail using JSTL
It's not a secret anymore!