Hi, Colin.

I appreciate your quick response. 

I'm working with Turbine 2.1.

The code I have in my action is the following:

public void EnviaMail extends VelocityAction
  {
  public void doSend(RunData data, Context context)
    {
    VelocityEmail     ve = new VelocityEmail(context);
    ve.setContext (context);
    ve.setTo("B. Marcellin", "[EMAIL PROTECTED]");
    ve.setFrom("B. Marcellin", "[EMAIL PROTECTED]");
    ve.setSubject("email test");
    ve.setTemplate("screens/EnviaMail.vm");
    try
      {
      ve.send();
      }
    catch (Exception e)
      {
      e.printStackTrace();
    }
  }

In the template (screens/EnviaMail.vm) I only coded a small text without
Velocity commands or variables.

In the vm, I'm calling the action through a submit button:;

<input type = "sbumit" name="eventSubmit_doSend" value="Submit"/>

In the screen component, I'm setting up the context:

context.put("VelocityEmail, new VelocityEmail());

That is basically what I have.

Thank you. 


-----Mensaje original-----
De: Colin Chalmers [mailto:[EMAIL PROTECTED]]
Enviado el: Viernes, 07 de Septiembre de 2001 03:26 a.m.
Para: [EMAIL PROTECTED]
Asunto: Re: Email functionality using Turbine/Velocity


Hi bernardo,

I've done some work on the email classes.

If you can tell me which version of Turbine you've got (2.1??) and a
snippet
of code I'll see how I can help you

/Colin

----- Original Message -----
From: "Bernardo Juan Marcellin Leautaud" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 07, 2001 4:17 PM
Subject: RE: Email functionality using Turbine/Velocity


Thank you, Matthew. This has helped me a lot. I'm right now trying to
fix a NullPointerException that I'm getting when executing the send(). I
guess I'm loosing a parameter or something like that. If you (or anyone
else) has an idea on how to fix it or on which could be the cause of the
problem, I would appreciate to know it.

Bernardo.

-----Mensaje original-----
De: Matthew Forder [mailto:[EMAIL PROTECTED]]
Enviado el: Mi�rcoles, 05 de Septiembre de 2001 08:45 p.m.
Para: [EMAIL PROTECTED]
Asunto: Re: Email functionality using Turbine/Velocity


Whoops...!!! Spotted a few typos. Lets try again...

Here's some example code that works for me...


VelocityEmail ve = new VelocityEmail(context);


ve.setTo(to, addr);
ve.setFrom("Fred Bloggs","[EMAIL PROTECTED]");
ve.setSubject("Pointless email");
ve.setTemplate("/email/some_message.vm");
ve.setWordWrap(72);
ve.send();


Important thing I found out is the the template path is below the
"screens" template dir, i.e. in the above example the real filepath is
/TDK_HOME/webapps/app/templates/app/email/some_message.vm


For the template itself, it's just like any other Velocity screen
template (only no need to define navigations or layouts).


Hope this helps!!!!


Regards,


Matt


Bernardo Juan Marcellin Leautaud wrote:


Hi,
I'm working in a project where we are including e-mail functionality.
While trying to set the template for the VelocityEmail, I'm getting a
ReferenceException. Does anyone know how should that template to be
create or what does it need to contain?

If anyone has a complete example for the e-mail functionality (including

vm's, screens, and actions), that would help a lot.


Thanks.


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

--

____ | Matthew J. Forder | Data Center Supervisor

/ / () | Seagate Techology | Tel:+31 20 316 7468

\ \ \ | Koolhovenlaan 1 | Fax:+31 20 653 5537

()_/_/ | 1119 NB Schiphol-Rijk, NL | [EMAIL PROTECTED]





---------------------------------------------------------------------
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