Updated and extended testsuite to match the last round of changes. Fixed bugs uncovered by the work. Some extensions: "header" attribute for mails.