Fixed order mail class, untested functions but no longer has syntax error.