Hello,

Well, maybe I should show you what I got so far. Currently I'm using the VelocityEmail class as follows:

VelocityEmail vemail = *new* VelocityEmail();
context.put("bestellung", oData); // here I put the oData-object into the context of the user, so that I can use it and read the data from the database
context.put("email", vemail);
vemail.setTo("SvenRichter", "emailaddress"); //
vemail.setFrom("Recipient", "emailadress");
vemail.setSubject("Bestellung");
vemail.setContext(context);
vemail.setTemplate("portlets/html/email-confirm.vm");
vemail.send();

And it works just fine for text-messages. But I just can't set the content-type to "text/html". As a result the email-client is displaying the message as text, instead of html. That's why I tried the following using the VelocityHtmlEmail class:

/VelocityHtmlEmail vemail = new VelocityHtmlEmail(data);/ /
context.put("vmail", vemail);/ /
context.put("bestellung", oData);/ /
vemail.addTo("emailaddress", "Sven Richter"); //data.getUser().getEmail());/
/vemail.setFrom("Recipient", "emailaddress");/ /
vemail.setHtmlTemplate("portlets/html/email-productpurcase.vm");/ /
vemail.send();

/But that way I can't use 'vemail.setContext(context);'. Because of that I can't access the data from the database using '$bestellung' in the template, which makes the whole thing useless to me.

Maybe now somebody knows what I can do? I think that's a pretty standard function for a Jetspeed portal.

Thanks a lot,
Sven.

Sven Richter schrieb:

Hello,

since no one seems to know a solution to my problem using VelocityEmail, maybe someone can tell me a way to generate a HTML-confirmation email from a velocity template using another class.

I know that there's a class VelocityHtmlEmail, but in that class I can't seem to pass the Context from the Java class to the template (there is no 'setContext()' in that class). Or maybe somebody can suggest me another class, that I could use (with a small example on how to use it).

Thanks a lot,
Sven.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to