YGSendMail 1.2.2
See the version list below for details.
dotnet add package YGSendMail --version 1.2.2
NuGet\Install-Package YGSendMail -Version 1.2.2
<PackageReference Include="YGSendMail" Version="1.2.2" />
paket add YGSendMail --version 1.2.2
#r "nuget: YGSendMail, 1.2.2"
// Install YGSendMail as a Cake Addin #addin nuget:?package=YGSendMail&version=1.2.2 // Install YGSendMail as a Cake Tool #tool nuget:?package=YGSendMail&version=1.2.2
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
/Warning! incorrect port or SecureSocketOptions could cause the instantiation to hang.
//It is best to test it first in a console program in debug mode
using (ISendMail sm = new SendMail(host, port, MailKit.Security.SecureSocketOptions.Auto, username, pwd)) // use whatever SecureSocketOptions works for you
{
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 of the source code 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.
Updated Readme and sample program - no functional changes