fixed all mailing functions