public Task SendAsync(IdentityMessage message) { var mvcMessage = new MvcMailMessage { Subject = message.Subject, Body = message.Body }; mvcMessage.To.Add(message.Destination); return mvcMessage.SendAsync(); }
/// <summary> /// Attempts to send an email message. /// </summary> /// <param name="message"> /// The message. /// </param> /// <exception cref="EmailSendFailureException"> /// All errors relating to sending the message will result in this exception. /// This allows for mailing errors to be easily handled. /// </exception> /// <remarks> /// Sending emails can result in a wide variety of exceptions. /// To make it easier to handle these exceptions upstream, all exceptions /// relating to the actual sending of the message are caught and wrapped into /// one exception. This is acceptable because code upstream doesn't care /// about how the message failed to send, only that it did fail. /// </remarks> /// <returns> /// The <see cref="Task"/>. /// </returns> private Task SendMessageAsync(MvcMailMessage message) { try { return message.SendAsync(); } catch (Exception ex) { throw new EmailSendFailureException(ex); } }