So you are looking for a package which extract your files from zip, tar, tar.gz, gz etc. Zip can be done easily with some PHP functions but for tar and other Linux archives we need some library to work with and extract files.
To make IMAP working with PHP we need to install these modules, install these from synaptic package manager.