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