]> git.mxchange.org Git - jmailer-ee.git/commitdiff
let the actual mailer define the mail session to use
authorRoland Haeder <roland@mxchange.org>
Thu, 7 Apr 2016 09:58:10 +0000 (11:58 +0200)
committerRoland Haeder <roland@mxchange.org>
Thu, 7 Apr 2016 09:58:10 +0000 (11:58 +0200)
src/org/mxchange/jmailee/model/delivery/BaseMailer.java

index df3b555b868b8fab0d5721413e6f362b2fe22835..ffb546fc8a6090871a978877716ffa4395d1aa9d 100644 (file)
@@ -18,7 +18,6 @@ package org.mxchange.jmailee.model.delivery;
 
 import java.text.MessageFormat;
 import java.util.Date;
-import javax.annotation.Resource;
 import javax.jms.MessageProducer;
 import javax.jms.ObjectMessage;
 import javax.mail.MessagingException;
@@ -45,12 +44,6 @@ public abstract class BaseMailer implements DeliverableEmail {
         */
        private static final long serialVersionUID = 14_598_912_753_106L;
 
-       /**
-        * Email session
-        */
-       @Resource (name = "jmail/jjobs")
-       private Session jmailjjobs;
-
        /**
         * Logger bean
         */
@@ -129,13 +122,14 @@ public abstract class BaseMailer implements DeliverableEmail {
         * @param emailAddress Email address for recipient
         * @param subjectLine  Subject line
         * @param body         Body part
+        * @param mailSession  Corresponding mail session to use
         * <p>
         * @throws NamingException    If the resource cannot be found
         * @throws MessagingException If something happened on message delivery
         */
-       protected void sendMail (final String emailAddress, final String subjectLine, final String body) throws NamingException, MessagingException {
+       protected void sendMail (final String emailAddress, final String subjectLine, final String body, final Session mailSession) throws NamingException, MessagingException {
                // Get MIME message instance
-               MimeMessage message = new MimeMessage(this.jmailjjobs);
+               MimeMessage message = new MimeMessage(mailSession);
 
                // Set subject, recipients and body
                message.setSubject(subjectLine);