OK people, once again
993 is the normal IMAP/ssl port for Gmail. But since you want to get your mails scanned by Avast, it can't work with 993 because it's an
ssl port >>> connection is encrypted. So the trick is to use 143/587 (or 25) instead, so that the mail client will receive/send mails from/to local host (127.0.0.1) in an unencrypted way. It's during this phase that Avast can scan, because the avast proxy is also connected to local host. On the other end of the proxy, Avast will be connected to the mail server (Gmail in this case) to/from 465(or 587)for SMTP and 993 for IMAP or 995 for POP.
Now depending on configurations, using 993 (without mail scanned) when the email scanner is on can block the connection completely. Sometime the proxy just lets go and you just get the pop up from avast, sometimes it blocks everything.