예제 #1
0
        public async Task <SendResponse> SendEmail(EmailContent content)
        {
            if (content == null || _credentials == null)
            {
                return(SendResponse.SendFailed("Email failed to send."));
            }

            try
            {
                var email      = ConstructEmail(content);
                var smtpClient = await ConstructClient();

                await smtpClient.SendAsync(email);

                await smtpClient.DisconnectAsync(true);

                return(SendResponse.SendSuccess("Email sent successfully."));
            }
            catch (Exception ex)
            {
                return(SendResponse.SendFailed($"Email failed to send. {ex}"));
            }
        }