saved = true; } else { MimeMessageInputStreamSource src = new MimeMessageInputStreamSource("MailCopy-" + UUID.randomUUID().toString()); OutputStream out = src.getWritableOutputStream(); original.writeTo(out); out.close();
OutputStream out = mmiss.getWritableOutputStream();
/** * A constructor that creates a MailImpl with the specified name, * sender, recipients, and message data. * * @param name the name of the MailImpl * @param sender the sender for this MailImpl * @param recipients the collection of recipients of this MailImpl * @param messageIn a stream containing the message source */ public MailImpl(String name, MailAddress sender, Collection recipients, InputStream messageIn) throws MessagingException { this(name, sender, recipients); MimeMessageSource source = new MimeMessageInputStreamSource(name, messageIn); // if MimeMessageCopyOnWriteProxy throws an error in the constructor we // have to manually care disposing our source. try { this.setMessage(new MimeMessageCopyOnWriteProxy(source)); } catch (MessagingException e) { LifecycleUtil.dispose(source); throw e; } }
OutputStream out = mmiss.getWritableOutputStream();
/** * 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>"); }