IMAPdump, requires OpenSSL to be installed. Install it using the following command:
$ sudo apt install openssl
The IO::Socket::SSL Perl module is also required. First, install using the following command:
$ sudo perl -MCPAN -e shell
Then enter the following command from within the cpan shell:
cpan[1]> install IO::Socket::SSL
Now IMAPdump should run without errors. You can download it from https://github.com/andrewnimmo/rick-sanders-imap-tools.