[ 
https://issues.apache.org/jira/browse/KYLIN-1807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15341437#comment-15341437
 ] 

Jörg Weule commented on KYLIN-1807:
-----------------------------------

At least something like the following method would be fine:

    public OutputStream getDataOutputStream() throws IOException
    {
        if (!SMTPReply.isPositiveIntermediate(data())) {
            return null;
        }
        _writer.flush();
        return new DotTerminatedMessageOutputStream(_output_);
    }



> Commons-net/SMTP: int 
> SMTPClient.sendMessageData(javax.mail.internet.MimeMessage mail)
> --------------------------------------------------------------------------------------
>
>                 Key: KYLIN-1807
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1807
>             Project: Kylin
>          Issue Type: Improvement
>          Components: Tools, Build and Test
>            Reporter: Jörg Weule
>            Assignee: hongbin ma
>            Priority: Minor
>
> Dear Sirs,
> I'm asking for an improvement to "commons-net" component "SMTP":
> Unfortunetly sendMessageData returns a Writer where MimeMessage is able to 
> writeTo(…) an OutputStream.
> The MimeMessage has to writeTo(new CountOutputStream(new 
> WriterOutputStream(smtpClient.sendMessageData(),"ISO-8859-1"))) using classes 
> from commons-io. Unfortunetly there is no example to implement this and 
> report the message size.
> Why is there not convenience method to send a MimeMessage an returns the 
> number of bytes send for mail statistics. This would do the job of writing to 
> the writer and closing that writer:
>   /* send the message */
>   Writer w = smtpClient.sendMessageData();
>   if ( w != null ) {
>     w.write(...);
>     w.close();
>   }
> Additionaly:
> If we could have a DotTerminatedMessageOutputStream, we could write directly 
> to the stream without the unneeded character transformation. The 
> DotTerminatedMessageWriter is not really using the characters and I think 
> this class can/should be implemented with bytes. When implementing a 
> DotTerminatedMessageOutputStream, a character count would be fine to report 
> the size of processed messages and to calculate performance data.
> With kind regards
> Jörg



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to