Integrate imapsync instead of getmail (imap)
imapsync seems easy to install and use and even supports sync of subfolders which getmail doesn't.
https://github.com/imapsync/imapsync
Found installation notes on: http://blog.grossi.io/2013/migrating-emails-using-imap-imapsync-tofrom-gmail-yahoo-etc/