Fix multipart email rendering #6378

* Refactored mail construction for different cases
* Added tests to verify the constructed email.message
Released version 3.0.2.7
Merge branch 'hotfix/3.2.0.7'