@SuppressWarnings("unchecked") public void sendMail(MailAddress sender, Collection recipients, MimeMessage message, String state) throws MessagingException { MailImpl mail = new MailImpl(mailServer.getId(), sender, recipients, message); try { mail.setState(state); sendMail(mail); } finally { LifecycleUtil.dispose(mail); } }
/** * Handler method called upon receipt of a DATA command. * Reads in message data, creates header, and delivers to * mail server service for delivery. * * @param session SMTP session object * @param argument the argument passed in with the command by the SMTP client */ protected SMTPResponse doDATA(SMTPSession session, String argument) { try { MimeMessageInputStreamSource mmiss = new MimeMessageInputStreamSource(mailServer.getId()); session.getState().put(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE, mmiss); } catch (MessagingException e) { session.getLogger().warn("Error creating mimemessagesource for incoming data",e); return new SMTPResponse(SMTPRetCode.LOCAL_ERROR, "Unexpected error preparing to receive DATA."); } // out = new PipedOutputStream(messageIn); session.pushLineHandler(getLineHandler()); return new SMTPResponse(SMTPRetCode.DATA_READY, "Ok Send data ending with <CRLF>.<CRLF>"); }
new MailImpl(mailServer.getId(), (MailAddress) session.getState().get(SMTPSession.SENDER), recipientCollection);
new MailImpl(mailServer.getId(), (MailAddress) session.getState().get(SMTPSession.SENDER), recipientCollection);