batteries.Email
1.0.13
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package batteries.Email --version 1.0.13
NuGet\Install-Package batteries.Email -Version 1.0.13
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="batteries.Email" Version="1.0.13" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add batteries.Email --version 1.0.13
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: batteries.Email, 1.0.13"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install batteries.Email as a Cake Addin #addin nuget:?package=batteries.Email&version=1.0.13 // Install batteries.Email as a Cake Tool #tool nuget:?package=batteries.Email&version=1.0.13
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
batteries.Email
Description
This package contains a useful email service based on MailKit.
Usage
The message bus manager can be used for managing multiple instances of message bus on different locations.
Here is how to use it:
Add the setting binding
builder.Services.AddOptions<SmtpSettings>() .BindConfiguration("MailSettings") .ValidateDataAnnotations() .ValidateOnStart(); builder.Services.AddSingleton(resolver => resolver.GetRequiredService<IOptions<SmtpSettings>>().Value);
Adapt your
appsettings.json
and include the necessary settings: <small>(remember some provider like gmail enforce the usage of app passwords)</small>"MailSettings": { "SmtpServer": "smtp.gmail.com", "Port": 465, "Username": "my-fancy-gmail-account@gmail.com", "Password": "xxxx xxxx xxxx xxxx", "SenderAddress": "no-reply@no-mail.com", "SenderName": "Fancy Service" }
Add the background service
builder.Services.AddSingleton<SmtpEmailService>(); builder.Services.AddSingleton<IHostedService, SmtpEmailService>(serviceProvider => serviceProvider.GetService<SmtpEmailService>()); builder.Services.AddSingleton<IEmailSender, SmtpEmailService>(serviceProvider => serviceProvider.GetService<SmtpEmailService>());
Inject the service (for example in one controller)
public class DataController : ControllerBase { private readonly ILogger<DataController> logger; private readonly IEmailSender sender; public DataController(ILogger<DataController> logger, IEmailSender sender) { this.logger = logger; this.sender = sender; } }
OAuth2 (and MS Office 356)
todo
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Azure.Identity (>= 1.13.2)
- MailKitLite (>= 4.9.0)
- Microsoft.Graph (>= 5.69.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.