From: Roland Haeder Date: Thu, 7 Apr 2016 09:58:10 +0000 (+0200) Subject: let the actual mailer define the mail session to use X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b58643925f3c10823f7e55d91562a67ee5986112;p=jmailer-ee.git let the actual mailer define the mail session to use --- diff --git a/src/org/mxchange/jmailee/model/delivery/BaseMailer.java b/src/org/mxchange/jmailee/model/delivery/BaseMailer.java index df3b555..ffb546f 100644 --- a/src/org/mxchange/jmailee/model/delivery/BaseMailer.java +++ b/src/org/mxchange/jmailee/model/delivery/BaseMailer.java @@ -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 *

* @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);