Prevent empty text part when only html part is assigned

Added tests and fixed same bug in WebAPI

Closes #19
Closes #17
Closes #16