protected Map < String , Object > createMessageHeaders ( MimeMailMessage msg ) throws MessagingException , IOException { Map < String , Object > headers = new HashMap <> ( ) ; headers . put ( CitrusMailMessageHeaders . MAIL_MESSAGE_ID , msg . getMimeMessage ( ) . getMessageID ( ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_FROM , StringUtils . arrayToCommaDelimitedString ( msg . getMimeMessage ( ) . getFrom ( ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_TO , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getRecipients ( javax . mail . Message . RecipientType . TO ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_CC , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getRecipients ( javax . mail . Message . RecipientType . CC ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_BCC , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getRecipients ( javax . mail . Message . RecipientType . BCC ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_REPLY_TO , StringUtils . arrayToCommaDelimitedString ( ( msg . getMimeMessage ( ) . getReplyTo ( ) ) ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_DATE , msg . getMimeMessage ( ) . getSentDate ( ) != null ? dateFormat . format ( msg . getMimeMessage ( ) . getSentDate ( ) ) : null ) ; headers . put ( CitrusMailMessageHeaders . MAIL_SUBJECT , msg . getMimeMessage ( ) . getSubject ( ) ) ; headers . put ( CitrusMailMessageHeaders . MAIL_CONTENT_TYPE , parseContentType ( msg . getMimeMessage ( ) . getContentType ( ) ) ) ; return headers ; }
Reads basic message information such as sender recipients and mail subject to message headers .