|
From: Kopylenko, D. <dko...@ac...> - 2003-09-10 19:52:04
|
Hello everybody,
Now there is a new mail support in the package org.springframework.mail
It follows the consistent Spring's template/callback pattern. The central
component is MailTemplate which uses MailSender strategy (which could be
implemented with any email protocol/API) and MailCallback. Typically
mailSender property on the MailTemplate is set through an
ApplicationContext. MailCallback has one method configure() in which the
client's implementation would configure the MailSettings value object with
properties needed to send mail. Also the JavaMailSender implementation is
provided.
Example usage:
MailTemplate mt = new MailTemplate();
MailSender ms = new JavaMailSender();
mt.setMailSender(ms);
mt.sendMail(new MailCallback() {
public void configure(MailSettings mailSettings) {
mailSettings.setMailTo("xx...@ya...");
mailSettings.setMailFrom("xx...@or...");
mailSettings.setMailSubject("test");
mailSettings.setMailText("test");
mailSettings.setMailHost("localhost");
}
});
Regards,
Dmitriy.
|