Fixed various bugs with buildling email body