Skip to content

Commit

Permalink
smtp sample is still wip
Browse files Browse the repository at this point in the history
  • Loading branch information
marklauter committed May 18, 2024
1 parent 18510df commit 5ab65eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Smtp.Pool/Smtp.Pool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MailKit" Version="4.5.0" />
<PackageReference Include="MailKit" Version="4.6.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
Expand Down
11 changes: 3 additions & 8 deletions src/Smtp.Pool/SmtpClientFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ public SmtpClientFactory(
this.credentials = credentials.Value;
}

public IMailTransport CreateItem()
{
public IMailTransport CreateItem() =>
// todo: a real world example would set values from SmtpClientOptions
return new SmtpClient();
}
new SmtpClient();

public async Task<bool> IsReadyAsync(IMailTransport item, CancellationToken cancellationToken)
{
return item.IsConnected
public async Task<bool> IsReadyAsync(IMailTransport item, CancellationToken cancellationToken) => item.IsConnected
&& item.IsAuthenticated
&& await NoOpAsync(item, cancellationToken);
}

private async Task<bool> NoOpAsync(IMailTransport item, CancellationToken cancellationToken)
{
Expand Down

0 comments on commit 5ab65eb

Please sign in to comment.