Fetching mail from custom imap and forward to Gmail

I need to get emails from an imap server with a custom port and forward these emails to Gmail. The imap server has a test certificate which should work smoothly.

My .fetchmailrc

poll mail.MAILSERVER.com with proto IMAP port 9999 auth password
     user 'USER' there with password 'PASSWORD' options keep
     sslfingerprint "12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef"
     smtpname "EMAILADDRESS@gmail.com"

To get the ssl fingerprint run fetchmail with -c -v.