@ SuppressWarnings ( "unchecked" ) private void initSession ( SMTPClientSession session ) { Iterator < SMTPDeliveryEnvelope > transactionList = ( ( Iterator < SMTPDeliveryEnvelope > ) session . getAttribute ( SMTP_TRANSACTIONS_KEY ) ) ; SMTPDeliveryEnvelope transaction = transactionList . next ( ) ; session . setAttribute ( CURRENT_SMTP_TRANSACTION_KEY , transaction ) ; session . setAttribute ( RECIPIENTS_KEY , transaction . getRecipients ( ) . iterator ( ) ) ; session . setAttribute ( DELIVERY_STATUS_KEY , new ArrayList < DeliveryRecipientStatus > ( ) ) ; // cleanup old attribute session . setAttribute ( CURRENT_RCPT_KEY , null ) ; }
Init the SMTPClienSesion by adding all needed data to the attributes