Add tests for various error mail sending scenarios