Ninjasoft.MailBuilder 1.1.0

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

// Install Ninjasoft.MailBuilder as a Cake Tool
#tool nuget:?package=Ninjasoft.MailBuilder&version=1.1.0

Ninjasoft.MailBuilder

A utility to help build email in code

Purpose

The purpose of this project is to provide a utility to build email messages in code.

Usage

Start by creating a new instance of 'MailMessageBuilder' in the following way

var mailMessageBuilder = new MailMessageBuilder();

This is setup as a builder pattern so the variable name from above is not necessary if that is the route you are going down.

There are two end paths of the builder: Send and Build

Build

The return type of Build is a MailMessage in the System.Net.Mail namespace.

var mailMessage = new MailMessageBuilder()
	.SetFrom("no-reply@domain.com")
	.AddRecipient("user@test.com")
	.Build();

Send

The return type of Send is void and will actually send the email if you have provided valid settings to the included proxy class.

var smtpProxy = new SmtpClientProxy();

new MailMessageBuilder(smtpProxy)
	.SetFrom("no-reply@domain.com")
	.AddRecipient("user@test.com")
	.Send();

There is also an async version of Send

var smtpProxy = new SmtpClientProxy();

await new MailMessageBuilder(smtpProxy)
	.SetFrom("no-reply@domain.com")
	.AddRecipient("user@test.com")
	.SendAsync();
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.
  • net6.0

    • No dependencies.

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.1.0 225 10/16/2023
1.0.1 116 9/22/2023
1.0.0 112 9/22/2023

Added support for attachments