|
From: Oliver H. <Oli...@ou...> - 2004-03-01 03:47:23
|
How would you go about doing this if you don't use JNDI? Is there a way
in spring to invoke the Session.getInstance method? I'd like to be able
to have all of the configuration for my MailSender in one place.
At the moment I've simply extended JavaMailSenderImpl so now my config
looks like this:
=20
<bean id=3D"javaMailSender"
class=3D"ourcommunity.util.email.OCJavaMailSenderImpl">
<property
name=3D"host"><value>${oc.mail.server.addr}</value></property>
<property name=3D"javaMailProperties">
<props>
<prop =
key=3D"mail.smtp.dsn.notify">SUCCESS,FAILURE</prop>
<prop key=3D"mail.smtp.dsn.ret">HDRS</prop>
</props>
</property>
</bean>=20
And OCJavaMailSenderImpl.java looks like this
package ourcommunity.util.email;
import java.util.Properties;
import javax.mail.Session;
import org.springframework.mail.javamail.JavaMailSenderImpl;
public class OCJavaMailSenderImpl
extends JavaMailSenderImpl
{
public void setJavaMailProperties(Properties props)
{
setSession(Session.getInstance(props));
}
}
But it seems to me this would be very useful for others if it was just
part of the standard Spring functionality.
-----Original Message-----
From: Darren Davison [mailto:da...@da...]=20
Sent: Monday, 1 March 2004 2:01 PM
To: spr...@li...
Subject: Re: [Springframework-developer] JavaMailSenderImpl
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 01 March 2004 02:42, Oliver Hutchison wrote:
> Hi,
>
> Except for extending JavaMailSenderImpl is there a way to specify=20
> extra properties that are used to instantiate the Session?
you can create your own javax.mail.Session object (populated with your=20
additional properties) and simply pass it to the=20
JavaMailSenderImpl.setSession(Session) method. This is particularly
handy=20
if you obtain your session from JNDI.
|