示例#1
0
 /**
  * Method createMetaContents.
  *
  * @param message
  * @return
  */
 private String createMetaContents(IMessageContext message) {
   Envelope envelope = message.getEnvelope();
   Partition partition = message.getPartition();
   StringBuffer buf = new StringBuffer(200);
   buf.append("Subject: ").append(envelope.getSubject()).append(MetaMessageWriterStage.NEW_LINE);
   Date sentDate = envelope.getSentDate();
   if (sentDate != null) {
     buf.append("Date: ")
         .append(MetaMessageWriterStage.s_rfc822DateFormat.format(sentDate))
         .append(MetaMessageWriterStage.NEW_LINE);
   }
   // If there is a header based sender that was found by the vault box, then use it.
   // The header based sender is usually in a nicer format "Bob Smith" <*****@*****.**>
   // instead of just the email address of the sender [email protected]
   String from;
   if (envelope.getHeaderBasedSender() != null && envelope.getHeaderBasedSender().length() > 3) {
     from = envelope.getHeaderBasedSender();
   } else {
     from = envelope.getSender();
   }
   if (from != null) {
     buf.append("From: ").append(from).append(MetaMessageWriterStage.NEW_LINE);
   }
   buf.append("Message-ID: ");
   buf.append(envelope.getSize());
   buf.append("__");
   buf.append("&mid=");
   buf.append(message.getInternalId());
   buf.append("&svr=");
   buf.append(partition.getServer());
   buf.append("&p=");
   buf.append(partition.getId());
   buf.append(MetaMessageWriterStage.NEW_LINE);
   return buf.toString();
 }