Fixed status codes, added email config where we want to use email

Here are fixes to status codes and another known issue. Please merge if all good or if there is any other fixes required