Complete rewrite for Powermail 2.1/3.0-F