|
From: <jue...@we...> - 2003-09-29 14:01:38
|
-----Original Message-----
From: j=FCrgen h=F6ller [werk3AT]=20
Sent: Monday, September 29, 2003 12:45 PM
To: 'Kopylenko, Dmitry'
Cc: 'Rod Johnson'
Subject: RE: [Springframework-developer] Mail support
Dmitriy,
I've just reviewed our mail support in detail. I really don't see any =
necessity for MailTemplate and MailCallback: I do not consider this a =
case for template/callback as there is no resource management involved. =
A callback doesn't add any benefits here.
Why not simply rely on MailSender in a library style, using MailSettings =
as parameter object? That gives all benefits of abstracting JavaMail, =
while completely avoiding an inner class callback implementation. I =
consider filling a parameter object as more natural here.
MailSettings mailSettings =3D new MailSettings();
mailSettings.setXXX(...);
mailSender.sendMail(mailSettings);
All things considered, I strongly prefer dropping MailTemplate and =
MailCallback in favor of direct MailSender usage. I see that =
MailTemplate already has the option of setting a user-specified =
MailSettings instance, but without the option of custom callbacks =
MailSender can be used directly.
Regards,
Juergen
-----Original Message-----
From: Kopylenko, Dmitry [mailto:dko...@ac...]
Sent: Tuesday, September 23, 2003 3:16 PM
To: j=FCrgen h=F6ller [werk3AT]
Cc: 'Rod Johnson'
Subject: RE: [Springframework-developer] Mail support
And another reason would be - the MailSettings is the property of
MailTemplate and could be configured/wired through the =
ApplicationContext,
then the client's code would need to provide "an empty" implementation =
of
the MailCallback in the call to sendMail() and not worried about
MailSettings in the code. So, please forgive me if I'm way off in my
thinking :-)) (with humor)=20
Dmitriy.
-----Original Message-----
From: j=FCrgen h=F6ller [werk3AT] [mailto:jue...@we...]=20
Sent: Tuesday, September 23, 2003 8:46 AM
To: Kopylenko, Dmitry; spr...@li...
Subject: RE: [Springframework-developer] Mail support
Just wondering from your description: Why doesn't the sendMail method =
simply
take a MailSettings parameter? The callback implementation doesn't use =
any
prepared resource like a JDBC Connection or Hibernate Session, so why =
use a
callback at all?
=20
BTW, we should definitely aim to agree on such public API before =
releasing
1.0 M2. Released APIs should stay as stable as possible.
=20
Juergen
=20
-----Original Message-----=20
From: Kopylenko, Dmitry [mailto:dko...@ac...]=20
Sent: Wed 9/10/2003 9:51 PM=20
To: 'spr...@li...'=20
Cc:=20
Subject: [Springframework-developer] Mail support
=09
=09
Hello everybody,=20
Now there is a new mail support in the package
org.springframework.mail=20
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:=20
MailTemplate mt =3D new MailTemplate();=20
MailSender ms =3D new JavaMailSender();=20
mt.setMailSender(ms);=20
mt.sendMail(new MailCallback() {=20
public void configure(MailSettings mailSettings) {=20
mailSettings.setMailTo("xx...@ya...");=20
=09
mailSettings.setMailFrom("xx...@or...");=20
mailSettings.setMailSubject("test");=20
mailSettings.setMailText("test");=20
mailSettings.setMailHost("localhost");=20
}=20
});=20
Regards,=20
Dmitriy.=20
|