import java.text.MessageFormat;
import java.util.Date;
-import javax.annotation.Resource;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.mail.MessagingException;
*/
private static final long serialVersionUID = 14_598_912_753_106L;
- /**
- * Email session
- */
- @Resource (name = "jmail/jjobs")
- private Session jmailjjobs;
-
/**
* Logger bean
*/
* @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);