YGSendMail 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package YGSendMail --version 1.0.0                
NuGet\Install-Package YGSendMail -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="YGSendMail" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YGSendMail --version 1.0.0                
#r "nuget: YGSendMail, 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.
// Install YGSendMail as a Cake Addin
#addin nuget:?package=YGSendMail&version=1.0.0

// Install YGSendMail as a Cake Tool
#tool nuget:?package=YGSendMail&version=1.0.0                

YGSendMail

A simple email sending functionality that uses MailKit to connect, authenticate, build and send the emails

Installation

Include this package in the project file

Usage

using (SendMail sm = new SendMail(host, port,ssl, username, pwd))
{
string errMsg = sm.ErrorMsg;
EmailDTO eml = new EmailDTO()
{
To = new string[] { to },
Subject = subject,
Body = body,
SenderEmail = senderEmail,
SenderName = senderName
};
string result = await sm.SendAsync(eml);
}

Attachments and LinkedResources can be added in eml object - see sample code in repo Attachments and LinkedResources can be filenames or filenames and byte[] contents

Examples

Test project is provided in the solution to illustrate how instantiate and invoke the email sending functionality

Output:

The output is a string. If there is any error, the output will show the error

Dependencies

MailKit MimeKit

Contributing

Any new ideas on how to enhance this class without adding much complexity, please adhere to SOLID principle

License

This project is licensed under the MIT License(LICENSE).

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. 
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.2.3 103 7/17/2024
1.2.2 100 5/17/2024
1.2.1 109 5/17/2024
1.2.0 97 5/17/2024
1.1.0 87 5/16/2024
1.0.0 113 5/16/2024

initial release