String userpass; if (initialResponse == null) { session.pushLineHandler(new AbstractSMTPLineHandler() { @Override protected Response onCommand(SMTPSession session, String l) { session.pushLineHandler(new AbstractSMTPLineHandler() { @Override protected Response onCommand(SMTPSession session, String l) {
/** * 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 */ @SuppressWarnings("unchecked") protected Response doDATA(SMTPSession session, String argument) { MaybeSender sender = (MaybeSender) session.getAttachment(SMTPSession.SENDER, ProtocolSession.State.Transaction); MailEnvelope env = createEnvelope(session, sender, new ArrayList<>((Collection<MailAddress>) session.getAttachment(SMTPSession.RCPT_LIST, ProtocolSession.State.Transaction))); session.setAttachment(MAILENV, env,ProtocolSession.State.Transaction); session.pushLineHandler(lineHandler); return DATA_READY; }
session.pushLineHandler(new AbstractSMTPLineHandler() {
/** * 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>"); }
/** * 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 */ @Override protected SMTPResponse doDATA(SMTPSession session, String argument) { try { MimeMessageInputStreamSource mmiss = new MimeMessageInputStreamSource(MailImpl.getId()); session.setAttachment(SMTPConstants.DATA_MIMEMESSAGE_STREAMSOURCE, mmiss, State.Transaction); } catch (Exception e) { LOGGER.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>"); }