It IS bound to specific ports. It would really be hard to do it otherwise (there would have to be a hook on every connection that would heuristically detect if this is a SMTP, POP3 or IMAP communication or not...).
The ports are governed by (yes you guessed it) some entries in the avast INI file, <avast>\data\avast4.ini.
In particular, the following settings are relevant:
[MailScanner]
PopRedirectPort=110
SmtpRedirectPort=25
ImapRedirectPort=143
(these may not be present in your INI file but are used anyway, with the default values stated above). The trick is that the Port entries actually support multiple ports, separated by commas. That is, if you want to use ports 143 AND 666, you'd simply have the following line in your ini file:
ImapRedirectPort=143,666
For the changes to become effective, e.g. restart the Internet Mail provider.
Thanks
Vlk
PS. Unfortunately it's currently not possible to exclude a process from on-access scanning.