public async Task <ActionResult> Create(FormCollection collection) { _O365ServiceOperationFailed = false; String newEventID = ""; try { newEventID = await _mailOperations.ComposeAndSendMailAsync(collection["Subject"], collection["Body"], collection["Recipients"]); } catch (Exception) { _O365ServiceOperationFailed = true; } return(RedirectToAction("Index", new { newid = newEventID })); }
/// <summary> /// Sends a mail item and adds it to the collection. /// </summary> /// <remarks>The mail item is created locally.</remarks> async void ExecuteSendMailCommandAsync() { try { if (string.IsNullOrEmpty(_newMailRecipients)) { LoggingViewModel.Instance.Information = "Please include at least one recipient."; } else { await _mailOperations.ComposeAndSendMailAsync(_newMailSubject, _newMailBodyContent, _newMailRecipients); LoggingViewModel.Instance.Information = "Your mail was sent."; } } catch (Exception ex) { LoggingViewModel.Instance.Information = "Error sending mail: " + ex.Message; } }
public async Task <ActionResult> Create(FormCollection collection) { String newEventID = await _mailOperations.ComposeAndSendMailAsync(collection["Subject"], collection["Body"], collection["Recipients"]); return(RedirectToAction("Index", new { newid = newEventID })); }