The mail session factory org.apache.openejb.core.MailSessionFactory creates a
mail session as follows:

public Session create() {
    return Session.getDefaultInstance(properties);
}

This way only one mail session can be configured in openejb.xml, namely the
default mail session.

The following modification in MailSessionFactory allows to configure
multiple mail sessions in openejb.xml:

public Session create() {
     return Session.getInstance(properties);
}

The configuration in openejb.xml looks as follows:

<Resource id="mail/Test" type="javax.mail.Session">
        mail.debug true
        mail.transport.protocol smtp
        mail.smtp.user username
        mail.smtp.password changeit
        mail.smtp.starttls.enable true
        mail.smtp.auth true
        mail.smtp.host mail.xyz.com
        mail.smtp.port 25
        mail.from [email protected]
        mail.store.protocol pop3s
        mail.pop3s.host mail.xyz.com
        mail.pop3s.port 995
        mail.pop3s.auth true
        mail.pop3s.user username
        mail.pop3s.password changeit
</Resource>

Not sure whether this is a feature or a bug request.

-werni.
-- 
View this message in context: 
http://www.nabble.com/MailSessionFactory-returns-default-mail-session-only-tp21696124p21696124.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Reply via email to