Sounds like you need to schedule an event. just changing the calendar date 
on the email object is not going to set "when" the email will be sent.

as soon as you call email.send() the email will be sent, regardless of the 
time/date stamp sitting on it.

there is an integrated scheduler with turbine for something like this, or 
I believe others have recommended quartz as a replacement to the turbine 
scheduler.



On Thu, 20 Jan 2005, jill han wrote:

> Hi, here is a situation.
> I want to send an email when an event occurs. And later on I want to
> send another email to the other addresses to ask if they responded to
> that email. Here are the part of codes.
>  
> VelocityHtmlEmail email = new VelocityHtmlEmail(context);
> email.setFrom(fromAddress);
> email.setSubject("Survey Alert!");
> email.addTo(toAddress());
> email.setHtmlTemplate(emailTemplate);
> try{
>        email.send();
>  } catch(Exception err) {
>        log.debug(err.toString());
>  }
>  
>  
> Calendar cal = Calendar.getInstance();
> int day = cal.get(cal.DATE) + 1;
> cal.set(Calendar.DATE, day);
> email = new VelocityHtmlEmail(context);
> email.setFrom(fromAddress);
> email.setSubject("Response Alert");
> email.addTo( toAddress());
> email.setSentDate(cal.getTime());
> email.setHtmlTemplate("emailTemplate");
> try{
>      email.send();
>  } catch(Exception err) {
>                     log.debug(+ err.toString());
>  
>  }   
>  
>  
> However, I got two mails at the same time.
> What went wrong?
>  
> Thanks in advance.
>  
> Jill
> 

-- 
Thank you,

Jeffery Painter
    2431 Reunion Meadows Lane
    Apex, NC 27539
    voice: 919.321.0378

- --
[EMAIL PROTECTED]                http://jeff.kiasoft.com
PGP FP: 9CE8 83A2 33FA 32B1 0AB1  4E62 E4CB E4DA 5913 EFBC

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE/qEQE5Mvk2lkT77wRAnMJAJ9vJ6qOkg/mvqqIpz7troCEQJ8bFACglu/U
YNXabx7DZOV2Hd9LwSTmGpY=
=dWiu
-----END PGP SIGNATURE-----

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

Reply via email to