How to send the message by email ?

X-Application Version: 3.1.2
Tamino Version : 3.1.1
Platform : Windows2000
WebContainer : Tomcat 3.3
JDK Version : 1.3.0_02
Hi,
After generating my own application using Tamino X-Application Generator I wanted to change list.jsp file in order to enable the user to send the message by email (chosen from the list). Now I can choose the email (I modified the source of the list.jsp file:
<bdm:display select="/email"/> )
after that I can see the screen to write a message but there is no name / email of the addressee and it is necessary to write it again.
Could you help me what to do to get the addressee?
Regards,
VS

One way is to use a piece of javascript like this:

<BR>function email() {<BR>  var mailTo = 'mailto:' + form1.<fieldname>.value + '&subject=Your subject';<BR>  self.location.href=mailTo;<BR>  self.location.href="page.jsp";<BR>}<BR>



Then invoke the code with


…where is some field in your form containing the target email address, and page.jsp is the active page.

So the javascript opens a mailto: window and then reverts to the active jsp page.

HTH

Hi,
I still have a problem. I don’t know how to get the value of email field.If I write it directly, for instance:
function email()
{ var mailto = ‘mailto:vs@ghff’ ;
self.location.href=mailto; self.location.href=“list.jsp”;}

it is OK, but what to do if I have to select one of the email address.
I enclose the source of my list.jsp

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"


http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<%@ page language=“java” contentType=“text/html;

charset=windows-1250” errorPage=“Error.jsp”%>
<%@ taglib uri=“http://www.softwareag.com/xtools/xapplication

prefix=“bdm” %>


Title


.link {
COLOR: #000000; FONT-WEIGHT: bold; TEXT-DECORATION: none
}
A {
COLOR: #000000; FONT-WEIGHT: bold; TEXT-DECORATION: none
}
A:link {
FONT-WEIGHT: bold
}
A:hover {
COLOR: #000000; FONT-WEIGHT: bold; TEXT-DECORATION: underline
}



<bdm:module id=“bdProp”>

























List


<bdm:form module=“bdProp”>
found

<bdm:display select="$COUNT"/>

document(s)
</bdm:form>



















<bdm:browse module=“bdProp”>










</bdm:browse>


Pos

Name

Surname

Telephone

email

City

Country



<bdm:action type=“read”><bdm:display select="$POS"/></bdm:action>


<bdm:display select="/name"/> <bdm:display select="/surname"/> <bdm:display select="/telephone"/> <bdm:display select="/email"/> <bdm:display select="/area/city"/> <bdm:display select="/area/country"/>













  <bdm:browsenavigation module=“bdProp” direction=“previous”>
</bdm:browsenavigation>
<bdm:browsenavigation module=“bdProp” direction=“next”>
</bdm:browsenavigation>



Start from:





 





</bdm:module>

This works for me (but there may be better ways??). First, change the script to accept a parameter:

function email(parm)
{
var mailto = “mailto:” + parm ;
self.location.href = mailto;
self.location.href = “list.jsp”;
}

…then pass the parameter whenever you invoke the script by href:


<a href=“javascript:email(’<bdm:display select=”/request/consultant"/>’)">
<bdm:display select="/request/consultant"/>


To be honest, I’m surprised this works - I expected the nested anchor and bdm tags to upset Tomcat, but they don’t. Does it work for you? :slight_smile:

Or if you don’t need to do any scripting on the “mailto:” url, you could just code:

<BR><a href="mailto:<bdm:display select='/request/consultant'/>"><BR><bdm:display select="/request/consultant"/><BR></a><BR>



That works too…
HTH

Hi
Thank you very much. It really works.
VS