コード例 #1
0
        private async Task <CsResult <bool> > SendEmailAsync(string from, string to, Dto.Email email)
        {
            var fromAddress = new EmailAddress(SenderEmail);
            var toAddress   = new EmailAddress(to);

            var msg = MailHelper.CreateSingleEmail(fromAddress, toAddress, email.Subject, string.Empty, email.Content);

            msg.SetReplyTo(new EmailAddress(from, email.Name));

            var response = await Client.SendEmailAsync(msg);

            if (response.StatusCode == System.Net.HttpStatusCode.Accepted)
            {
                return(CsResult.CreateResult(true));
            }

            var content = await response.Body.ReadAsStringAsync();

            return(CsResult <bool> .createError(content));
        }
コード例 #2
0
 public Task <CsResult <bool> > AskForHelpAsync(string from, Dto.Email email)
 => SendEmailAsync(from, HelpEmail, email);
コード例 #3
0
 public Task <CsResult <bool> > SendFeedbackAsync(string from, Dto.Email email)
 => SendEmailAsync(from, FeedbackEmail, email);