private String parseEnvelope ( ) { List < String > response = new ArrayList <> ( ) ; //1. Date --------------- response . add ( LB + Q + sentDateEnvelopeString + Q + SP ) ; //2. Subject --------------- if ( subject != null && ( subject . length ( ) != 0 ) ) { response . add ( Q + escapeHeader ( subject ) + Q + SP ) ; } else { response . add ( NIL + SP ) ; } //3. From --------------- addAddressToEnvelopeIfAvailable ( from , response ) ; response . add ( SP ) ; //4. Sender --------------- addAddressToEnvelopeIfAvailableWithNetscapeFeature ( sender , response ) ; response . add ( SP ) ; addAddressToEnvelopeIfAvailableWithNetscapeFeature ( replyTo , response ) ; response . add ( SP ) ; addAddressToEnvelopeIfAvailable ( to , response ) ; response . add ( SP ) ; addAddressToEnvelopeIfAvailable ( cc , response ) ; response . add ( SP ) ; addAddressToEnvelopeIfAvailable ( bcc , response ) ; response . add ( SP ) ; if ( inReplyTo != null && inReplyTo . length > 0 ) { response . add ( inReplyTo [ 0 ] ) ; } else { response . add ( NIL ) ; } response . add ( SP ) ; if ( messageID != null && messageID . length > 0 ) { messageID [ 0 ] = escapeHeader ( messageID [ 0 ] ) ; response . add ( Q + messageID [ 0 ] + Q ) ; } else { response . add ( NIL ) ; } response . add ( RB ) ; StringBuilder buf = new StringBuilder ( 16 * response . size ( ) ) ; for ( String aResponse : response ) { buf . append ( aResponse ) ; } return buf . toString ( ) ; }
Builds IMAP envelope String from pre - parsed data .