m2nj.Utilities 1.0.0

dotnet add package m2nj.Utilities --version 1.0.0
                    
NuGet\Install-Package m2nj.Utilities -Version 1.0.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="m2nj.Utilities" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="m2nj.Utilities" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="m2nj.Utilities" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add m2nj.Utilities --version 1.0.0
                    
#r "nuget: m2nj.Utilities, 1.0.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.
#:package m2nj.Utilities@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=m2nj.Utilities&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=m2nj.Utilities&version=1.0.0
                    
Install as a Cake Tool

m2nj.Utilities

m2nj.Utilities is a lightweight .NET utility package currently providing SMTP email sending with optional file attachments.

Author

This package is created and maintained by m2nj.

Installation

dotnet add package m2nj.Utilities --version 1.0.0

Usage

Send an email without attachments

using m2nj.Utilities;

SmtpUtilities.SendEmail(
    smtpServer: "smtp.example.com",
    from: "sender@example.com",
    to: "recipient@example.com",
    cc: "copy@example.com",
    bcc: null,
    subject: "Test email",
    emailBody: "<p>Hello from m2nj.Utilities.</p>");

Send an email with attachments

using System.Collections.Generic;
using m2nj.Utilities;

var attachments = new List<string>
{
    @"C:\temp\report.pdf",
    @"C:\temp\notes.txt"
};

SmtpUtilities.SendEmail(
    smtpServer: "smtp.example.com",
    from: "sender@example.com",
    to: "recipient@example.com",
    cc: "copy@example.com",
    bcc: "hidden@example.com",
    subject: "Daily report",
    emailBody: "<h1>Daily report</h1><p>Attached files are included.</p>",
    attachmentPaths: attachments);

Replace the example addresses, SMTP host, and attachment paths with values for your environment. The current API accepts the SMTP server host first, followed by sender, recipients, subject, body, and optional attachment paths. It does not expose SMTP credentials, port, or SSL configuration; it relies on SmtpClient defaults and runtime environment configuration. Ensure the host is a valid DNS-resolvable SMTP server configured for those defaults.

Sample file

The NuGet package includes samples/Program.cs with calls for sending a basic email and an email with attachments. Replace the example addresses, SMTP host, and attachment paths with values for your environment before running it. The source sample project is in the m2nj.Utilities.Sample folder.

Notes

  • The calling application is responsible for providing a valid SMTP server host.
  • This library does not include any SMTP infrastructure or mail server.
  • The message body is treated as HTML by default.
  • Attachment paths are checked for existence before they are added to the message.

License

This package is distributed under the custom m2nj Free Use and Distribution License in License.txt. Review the terms before redistributing or modifying the package.

Product 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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.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.0.0 116 10/14/2026