Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jrun:sendmail using a dynamic subject

Status
Not open for further replies.

vivasuzi

Programmer
Jun 14, 2002
183
0
0
Hello!

I am trying to get a subject to be created dynamically when the email is sent.

Here is code

Code:
<%
String requireddate = request.getParameter("requireddate");
String requiredname = request.getParameter("requiredname");
.
.
.
More strings here
%>


Later on....



<jrun:sendmail host="domino2" sender="myemail@emailme.com" recipient="myemail@emailme.com" subject="Ordered By: [COLOR=red]YourName[/color]">

Request Date: <%out.println(requireddate);%>
Contact's Name: <%out.println(requiredname );%>
...
other fields printed out here
...
</jrun:sendmail>

Basically, where it says YourName I want to dynamically put the requiredname as retrieved from the form.

I've tried putting subject="Ordered By: <%out.println(requiredname );%>"

And I've tried I've tried putting subject="Ordered By: <%=requiredname%>"

Both times the subject will come through as code exactly as it looks above. The body text all comes through fine. I'm more of an ASP person, so I'm not sure what to do. Please help!

Thanks!

[cat2] *Suzanne* [elephant2]
[wavey] [wiggle]
 
Suzi,

I think the problem lies within the JRun tag implemetation.

In JSP tags (when your write them), there is a choice between accepting dynamic content (ie , <%= string %> syntax), or not. It appears that your jrun:sendmail tag will not accept dynamic content. Bit poor really - but them JRun is !

I guess you'll need to use a custom JavaMail class - its a fairly easy API, and there are lots of examples/tutorials on the web and .

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
I'm surprised that

subject="Ordered By: <%=requiredname%>"

doesn't work.

Try:

subject="<%="Ordered By: " + requiredname%>"


Here is a sample of sendmail code in a JSP I wrote (w/ JRun) that works and applies the principles you're trying to use:

Code:
<jrun:sendmail host="mail1.ourhost.gov" sender="<%=userEmail%>" recipient="<%=recipientList%>" subject="<%=mailSubject%>" bcc="<%=bCC%>">
<jrun:mailparam attachurl="<%=pathAndFile%>" />
<%=mailMessage%>
</jrun:sendmail>

'hope something in this helps.

Good luck.

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top