public IActionResult CreateEmail(Email email) { try { //Here should be validation of email address email.Sender = email.Sender ?? _config.GetValue <string>("AppSettings:sender"); _emailCommands.Create(email); return(Ok(email)); } catch (Exception ex) { //Logger.LogError...... return(BadRequest($"Wystąpił błąd: {ex.Message}")); } }