SendEmail_Ltnm 3.0.0
dotnet add package SendEmail_Ltnm --version 3.0.0
NuGet\Install-Package SendEmail_Ltnm -Version 3.0.0
<PackageReference Include="SendEmail_Ltnm" Version="3.0.0" />
paket add SendEmail_Ltnm --version 3.0.0
#r "nuget: SendEmail_Ltnm, 3.0.0"
// Install SendEmail_Ltnm as a Cake Addin #addin nuget:?package=SendEmail_Ltnm&version=3.0.0 // Install SendEmail_Ltnm as a Cake Tool #tool nuget:?package=SendEmail_Ltnm&version=3.0.0
support config Environment Variable: ENV EMAIL_HOST (string) ENV EMAIL_PORT (int) ENV EMAIL_ENABLESSL (bool) ENV EMAIL_DEFAULTCREDENTIALS (bool) ENV EMAIL_USERNAME (string) ENV EMAIL_PASSWORD (string) ENV EMAIL_BODYISHTML (bool)
Send Mail Sample Support Only dotnet Core Config Step By Step. Step one: Add config to file "appsettings.json": "Email": { "Smtp": { "Host": "host_mail", "Port": 25, "Username": "user_mail", "Password": "password_user_mail", "DefaultCredentials": false }, "EnableSsl": false, "BodyIsHtml": true },
Step two add middleware to ConfigureServices: services.Configure<EmailSetting>(Configuration.GetSection("Email")); services.AddScoped<IEmailService, EmailService>();
Step three add services and use:
Method: SendEmail(string template, string layout, string subject, Dictionary<string, string> mergedFields, List<string> toReceipients, List<string> bccToReceipients = null, List<string> ccToReceipients = null, Dictionary<string, byte[]> attachments = null, string displayName = null)
NOTE: parameter "layout" required has text "[[Content]]", "mergedFields" is list key and value mapping to template has text "[[key]]" and "[[key]]" will replace equal value
Example:
public class HomeController : Controller { private IEmailService _mailSvc;
public HomeController(IEmailService mailSvc) { _mailSvc = mailSvc; }
[HttpGet("sendmail")] public IActionResult Senmail() { Dictionary<string, string> fiels = new Dictionary<string, string>(); fiels.Add("item", "luantran"); return Ok(_mailSvc.SendMail("ACB [[item]]", "Layout SendMail [[Content]] end layout", "Test Send mail" , fiels, new List<string> { "abc@acb.vn" })); } }
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp3.0 is compatible. netcoreapp3.1 was computed. |
-
.NETCoreApp 3.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.