コード例 #1
0
            public async Task <string> Execute(SendEmailInput input)
            {
                await Task.Yield();

                Input = input;
                return("SendEmail");
            }
コード例 #2
0
        public async Task SendMail()
        {
            var attachmentFile = new FileDescription[0];

            attachmentFile = attachmentFile.Append(new FileDescription
            {
                FileName = "BinhNguyen attachment file name",
                Data     = await File.ReadAllBytesAsync(@"E:\\config_background.txt")
            }).ToArray();

            var sendEmailInput = new SendEmailInput
            {
                Content         = string.Empty,
                Subject         = string.Empty,
                RecipientEmails = new string[] { "*****@*****.**" },
                AttachmentFiles = attachmentFile
            };

            await _sendMailService.SendMails(sendEmailInput);
        }
コード例 #3
0
        public async Task SendMails(SendEmailInput inputDto)
        {
            inputDto.Subject = inputDto.Subject.GetValueOrDefault("[Thư gửi không có tiêu đề]");

            var body = inputDto.Content
                       + $"</br><p><i>* Đây là email được gửi thông qua hệ thống, nếu có phản hồi, vui lòng gửi về email: [email protected] </i></p>";

            var emailsToSend = inputDto.RecipientEmails.Concat(inputDto.CcEmails.IfNotNull(x => x, new string[0]))
                               .Concat(inputDto.BccEmails.IfNotNull(x => x, new string[0]));

            foreach (var recipientEmail in emailsToSend)
            {
                await SendEmailAsync(
                    "Binh Nguyen",
                    "*****@*****.**",
                    "",
                    recipientEmail,
                    inputDto.Subject,
                    body,
                    null,
                    inputDto.AttachmentFiles);
            }
        }
コード例 #4
0
 public static bool IsEmailSent(this IServiceProvider source, SendEmailInput input)
 {
     return(((FakeEmailSender)source.GetService <IEmailSender>()).IsEmailSent(input));
 }
コード例 #5
0
 internal bool IsEmailSent(SendEmailInput input) =>
 _store.ContainsKey($"{input.To}:{input.Subject}:{input.TemplateName}");
コード例 #6
0
 public ValueTask SendAsync(SendEmailInput input)
 {
     _store.TryAdd($"{input.To}:{input.Subject}:{input.TemplateName}", input);
     return(new ValueTask());
 }
コード例 #7
0
ファイル: EmailSender.cs プロジェクト: mruhul/BDDShop
 public ValueTask SendAsync(SendEmailInput input)
 {
     // assume we sending :) Ignore for now
     return(new ValueTask());
 }