DynamicURI url = new DynamicURI(rundata);
//build body via template
StringWriter email_body = new StringWriter();
SimpleEmail se = new SimpleEmail();
Context emailContext = TurbineVelocity.getContext();
emailContext.put( "data", rundata );
emailContext.put( "user", user );
emailContext.put( "config",new JetspeedResources());
emailContext.put( "urltojetspeed",url);
emailContext.put( "email",se);
//determine the language to be used for the notification email
String language = (String)user.getPerm("language",TurbineResources.getString("locale.default.language", "en"));
String country = (String)user.getPerm("country",TurbineResources.getString("locale.default.country", "US"));
Locale locale = new Locale(language,country);
String templateFile = JetspeedResources.getString("newuser.approval.reject.template");
String templatePath = TemplateLocator.locateEmailTemplate(rundata, templateFile, locale );
TurbineVelocity.handleRequest(emailContext, templatePath, email_body);
se.setMsg( email_body.toString() );
Properties props = System.getProperties();
String mailServerMachine = JetspeedResources.getString( "mail.server" );
props.put ( "mail.host", mailServerMachine );
props.put("mail.smtp.host", mailServerMachine);
se.send();
} catch (Exception e)
{
// log the error msg
logger.error("Exception", e);