Skip to content

Commit b98c25d

Browse files
Use ConnectAsync in MimeKitEmailSender for async SMTP connection (#837)
1 parent 926b025 commit b98c25d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Clean.Architecture.Infrastructure/Data/Queries/FakeListContributorsQueryService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public class FakeListContributorsQueryService : IListContributorsQueryService
77
{
88
public Task<IEnumerable<ContributorDTO>> ListAsync()
99
{
10-
List<ContributorDTO> result =
10+
IEnumerable<ContributorDTO> result =
1111
[new ContributorDTO(1, "Fake Contributor 1", ""),
1212
new ContributorDTO(2, "Fake Contributor 2", "")];
1313

14-
return Task.FromResult(result.AsEnumerable());
14+
return Task.FromResult(result);
1515
}
1616
}

src/Clean.Architecture.Infrastructure/Email/MimeKitEmailSender.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public async Task SendEmailAsync(string to, string from, string subject, string
1717
_logger.LogWarning("Sending email to {to} from {from} with subject {subject} using {type}.", to, from, subject, this.ToString());
1818

1919
using var client = new SmtpClient();
20-
client.Connect(_mailserverConfiguration.Hostname,
20+
await client.ConnectAsync(_mailserverConfiguration.Hostname,
2121
_mailserverConfiguration.Port, false);
2222
var message = new MimeMessage();
2323
message.From.Add(new MailboxAddress(from, from));

0 commit comments

Comments
 (0)