m2nj.Utilities
1.0.0
dotnet add package m2nj.Utilities --version 1.0.0
NuGet\Install-Package m2nj.Utilities -Version 1.0.0
<PackageReference Include="m2nj.Utilities" Version="1.0.0" />
<PackageVersion Include="m2nj.Utilities" Version="1.0.0" />
<PackageReference Include="m2nj.Utilities" />
paket add m2nj.Utilities --version 1.0.0
#r "nuget: m2nj.Utilities, 1.0.0"
#:package m2nj.Utilities@1.0.0
#addin nuget:?package=m2nj.Utilities&version=1.0.0
#tool nuget:?package=m2nj.Utilities&version=1.0.0
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 | 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. 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. |
-
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 |