My workaround worked fine with avast!4.5. I’ve just updated avast! to 4.6 and found a few things changed.

[1] Avast! 4.6 doesn’t seem to accept the setting in your mail client such as “username#mailserver:port”. Therefore (3) and (4) in my workaround posted above don’t work any more. (2) has to be revised, too. (Refer to the information below [2].)

[2] In Resident task settings for Internet Mail in avast!4.6 you can set redirect ports and decide if avast! should ignore local communication or not. (Up to avast!4.5, you had to open the avast.ini file and set the values for Pop/Smtp/ImapRedirectPort and IgnoreLocalhost if you wanted to set them.) In the Redirect tab in Resident task settings for Internet Mail, you should uncheck “Ignore local communication” and set up the redirected ports. When you do that, the values will be written in the avast.ini file.
I think, if you get your email to go through your mail client, Spamihilator, avast!, Stunnel, and your remote mail server in this order, you need to set as the redirected port the port where Stunnel listens. If you get your email to go through your mail client, Spamihilator, avast!, and your remote mail server in this order, you need to set as the redirected port the port where your remote mail server listens, that is, your mail server’s port.

[3] In avast!4.6 the default listen ports seem to be 12110 for POP, 12025 for SMTP, 12143 for IMAP, and 12119 for NNTP, or the standard ports for all protocols (110 for POP, 25 for SMTP, 143 for IMAP, 119 for NNTP). You might change them in the avast.ini file if you need to. You can’t manipulate these values through Resident task settings. If you set up the listen ports before updating to avast!4.6, the ports you’ve set seem not to be changed in updating. (But the listen port for NNTP was never set before, so it was set as 12119 when I updated avast! and restarted my computer.)

I have to change my settings now because I’ve used “username#mailserver:port” style settings. Anyway, you need to set 0 as the value for “IgnoreLocalhost” in avast!4.6, I believe.

I will post a better explanation later.