Prevent empty text part when only html part is assigned

This is a fork of #17.  It has tests and fixes the same bug in the web api implementation