I've checked the mailing list archive, I saw the example code in the VelocityEmail 
javadoc and found no other useable resources.

So my question remains: how do I use VelocityEmail standalone? (In my case from a 
Struts web app). With the few bits and pieces I found online I constructed the 
following setup:

I have - amongst others - in WEB-INF/lib the libraries turbine-2.2.jar, 
velocity-dep-1.3.1.jar and commons-configuration-1.0-dev.jar. 

I have TurbineResources.properties in the classpath (WEB-INF/classes) which contains 
one entry: mail.server=192.x.y.z

Somewhere in my code, I go:

    String contextRootRealPath = 
getServlet().getServletContext().getRealPath(File.separator);
   
   VelocityContext context = new VelocityContext();

   VelocityEmail velocityEmail = new VelocityEmail();
   velocityEmail.setTo("The recipient", "[EMAIL PROTECTED]");
   velocityEmail.setFrom("The originator", "[EMAIL PROTECTED]").setSubject("Hope this 
works");
   velocityEmail.setContext(context);
   
   velocityEmail.setTemplate(contextRootRealPath + "/email/email.vm");
   try {
    velocityEmail.send();
   } catch (Exception e) {
    logger_.debug("Sending email failed", e);
    
   }


No email is received on [EMAIL PROTECTED] The email is not stuck on our smtp server. 
The application does not crash and there is no exception logging. 

What I am doing wrong? Or, to put it differently: what exactly do I have to do? ;-)

Tia!
pascal

Reply via email to