You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Matthew Pomar <ma...@mac.com> on 2004/04/14 02:27:59 UTC

Problem: VelocityEmail

I'm using the VelocityEmail class with Turbine 2.3. My code works fine 
in that the template file is read and sent, however the Velocity 
variables are not being parsed:



			log.debug("create velocity email object");
			VelocityEmail email = new VelocityEmail();

			context.put("message",((Email)email));
			
			context.put("gabba",new String("gabbahey"));				
			
			
			log.debug("set to name: " + group.get("FullName"));
			log.debug("set to email: " + group.get("Email"));
			email.addTo(group.get("Email").toString(),
				group.get("FullName").toString());

			log.debug("set from email: " + 
config.getString("project.email.global.from.email"));
			log.debug("set from name: " + 
config.getString("project.email.global.from.name"));
			email.setFrom(config.getString("project.email.global.from.email"),
				config.getString("project.email.global.from.name"));			
			
			
			email.setSubject(group.get("Subject").toString());

			
			email.setContext(context);

			email.setTemplate("app/emails/contact.vm");	
		
			
			email.send();


I've even tried to run the simple example listed in the JavaDocs for 
VelocityEmail and it didn't work either (the email sent, but the 
Velocity variables did not parse):


  VelocityEmail ve = new VelocityEmail();
  ve.setTo("Jon Stevens", "me@me.com");
  ve.setFrom("Mom", "mom@mom.com").setSubject("Eat dinner");
  ve.setContext(context);
  ve.setTemplate("app/emails/contact.vm");
  ve.send();


I appreciate any help you provide.

Thanks
  - Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org