YGSendMail 1.1.0
See the version list below for details.
dotnet add package YGSendMail --version 1.1.0
NuGet\Install-Package YGSendMail -Version 1.1.0
<PackageReference Include="YGSendMail" Version="1.1.0" />
paket add YGSendMail --version 1.1.0
#r "nuget: YGSendMail, 1.1.0"
// Install YGSendMail as a Cake Addin #addin nuget:?package=YGSendMail&version=1.1.0 // Install YGSendMail as a Cake Tool #tool nuget:?package=YGSendMail&version=1.1.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,MailKit.Security.SecureSocketOptions.StartTlsWhenAvailable , 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 | 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added ISendMail interface, added SecureSocketOption enum