Fix various warnings.

- First change fixes a warning when there isn't any email content
- Second change fixes a warning when HTML is invalid and DOMDocument is a
  little too strict during HTML parsing