fixed some email variables, also added msgid to email headers