Octasharp.EmailServices 1.0.2

dotnet add package Octasharp.EmailServices --version 1.0.2                
NuGet\Install-Package Octasharp.EmailServices -Version 1.0.2                
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="Octasharp.EmailServices" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Octasharp.EmailServices --version 1.0.2                
#r "nuget: Octasharp.EmailServices, 1.0.2"                
#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 Octasharp.EmailServices as a Cake Addin
#addin nuget:?package=Octasharp.EmailServices&version=1.0.2

// Install Octasharp.EmailServices as a Cake Tool
#tool nuget:?package=Octasharp.EmailServices&version=1.0.2                

EmailServices

MIT License

EmailServices is a library to facility the email sending in .Net projects.

Tech

EmailServices uses a number of open source projects to work properly:

Installation

EmailServices requires .Net Framework 6+ to run.

Nuget Package manager

Install-Package Octasharp.EmailServices

.Net CLI

dotnet add package Octasharp.EmailServices

You can see more ways to install EmailServices in your project here.

Implementing

Add MailSettings in appsettings

"MailSettings": {
    "UserName": "", // email address
    "From": "", // email address that will be displayed to receiver
    "Password": "", // email password
    "Host": "", // email host
    "Port": 0 // email port
}

or

"EMAIL_USERNAME": "", // email address
"EMAIL_FROM": "", // email address that will be displayed to receiver
"EMAIL_PASSWORD": "", // email password
"EMAIL_HOST": "", // email host
"EMAIL_PORT": 0 // email port

Add DI Namespace

using EmailServices.DI;

Add Project Dependency Injection

builder.Services.AddEmailServices(builder.Configuration);

Add Interfaces and Models Namespace

using EmailServices.Interfaces;
using EmailServices.Models;

Inject IMailServices

public ClassName(IMailServices mailServices) =>
    _mailServices = mailServices;

private readonly IMailServices _mailServices;

Instance a new MailRequestModel

var mailRequest = new MailRequestModel("receiver@email.com", "subject", "email <strong>body</strong>.");

It's all done! Just send your email

await _mailServices.SendAsync(mailRequest, cancellationToken);
_mailServices.Send(mailRequest);
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 480 3/15/2022
1.0.1 429 3/1/2022
1.0.0 433 2/27/2022