public Iterator < String > getMessages ( ) { Iterator < SmtpMessage > it = server . getReceivedEmail ( ) ; List < String > msgs = new ArrayList <> ( ) ; while ( it . hasNext ( ) ) { SmtpMessage msg = it . next ( ) ; msgs . add ( msg . toString ( ) ) ; } return msgs . iterator ( ) ; }
Returns an iterator of messages that were received by this server .