I was dropped in a medium sized mail migration project (~500 mail accounts).
Because we don't have an admin access on the old server, we need to migrate every mail account with their own credentials.
The first thing we need to do in this method is to ask for a CSV with accounts credentials and check if all informations are useable for the migration.
To do that i've wrote a little script available on my git mail-account-checker
The script is written in python 2.7 it can test IMAP/IMAP SSL and POP SSL
It simply need a CSV with credentials structured like this
firstname.lastname@example.org,password,imap email@example.com,password,imaps firstname.lastname@example.org,password,pops
And execute it
mail-account-checker -i accounts.csv
By default the target server is "localhost" if you need to use another hostname you can use the -H argument
mail-account-checker -H imap.gmail.com -i accounts.csv
If your CSV file is not structured like that you can set the column number of all data
Example, my csv look like this one
As you can see, the username have no domain, username and password are not in 0 and 1 column and on top of that, there is no protocol.
mail-account-checker -i accounts.csv -u 2 -p 3 -d makz.me -P imaps
Here we go