/** * {@inheritDoc} * * @return {@link SendMailSession} */ @Override public SendMailSession createSession() { final Session session = Session.getInstance(createSessionProperties(), authenticator); final Transport mailTransport; try { mailTransport = getTransport(session); } catch (final NoSuchProviderException nspex) { throw new MailException(nspex); } return new SendMailSession(session, mailTransport); }
private Message createMessage(final Email email) throws MessagingException { final SendMailSession testSendMailSession = new SendMailSession(null, null); return testSendMailSession.createMessage(email); }
/** * Creates EML string from given {@link Email}. * * @param email {@link Email} from which to create EML {@link String}. * @return {@link String} with EML content. */ public String compose(final Email email) { if (getSession() == null) { createSession(getProperties()); } final OutputStreamTransport ost = new OutputStreamTransport(getSession()); final SendMailSession sendMailSession = new SendMailSession(getSession(), ost); sendMailSession.sendMail(email); return ost.getEml(); }
/** * {@inheritDoc} * * @return {@link SendMailSession} */ @Override public SendMailSession createSession() { final Session session = Session.getInstance(createSessionProperties(), authenticator); final Transport mailTransport; try { mailTransport = getTransport(session); } catch (final NoSuchProviderException nspex) { throw new MailException(nspex); } return new SendMailSession(session, mailTransport); }
/** * Creates EML string from given {@link Email}. * * @param email {@link Email} from which to create EML {@link String}. * @return {@link String} with EML content. */ public String compose(final Email email) { if (getSession() == null) { createSession(getProperties()); } final OutputStreamTransport ost = new OutputStreamTransport(getSession()); final SendMailSession sendMailSession = new SendMailSession(getSession(), ost); sendMailSession.sendMail(email); return ost.getEml(); }