CoreMailer 2.1.0
See the version list below for details.
dotnet add package CoreMailer --version 2.1.0
NuGet\Install-Package CoreMailer -Version 2.1.0
<PackageReference Include="CoreMailer" Version="2.1.0" />
paket add CoreMailer --version 2.1.0
#r "nuget: CoreMailer, 2.1.0"
// Install CoreMailer as a Cake Addin
#addin nuget:?package=CoreMailer&version=2.1.0
// Install CoreMailer as a Cake Tool
#tool nuget:?package=CoreMailer&version=2.1.0
CoreMailer
Send email from .NET Core 3.0 with razor template Check the exmple code for details 😃 happy coding
How to Use:
To Install
npm install CoreMailer -Version 2.1.0
In Startup.cs add
services.AddScoped<ITemplateRenderer, TemplateRenderer>();
services.AddScoped<ICoreMvcMailer, CoreMvcMailer>();
services.AddRazorPages(); // Need this to work with RazorViewTemplate
Create cshtml template under any views folder e.g.
Views/Emails/Registration.cshtml
The content of cshtml can be
@model UserInfo
Hello <strong>@Model.UserName</strong> you are <strong>Awxam</strong>
NOTE: For emails you have to use inline styling.
in the controller use following:
Constructor
private readonly ICoreMvcMailer _mailer;
public HomeController(ICoreMvcMailer mailer)
{
_mailer = mailer;
}
ActionMethod
public IActionResult About()
{
MailerModel mdl = new MailerModel("YourHostName",1234)
{
FromAddress = "Your Address",
IsHtml = true,
User = "YourUserName",
Key ="YourKey",
ViewFile = "Emails/Register",
Subject = "Registration",
Model = new // Your actual class model
{
}
};
_mailer.Send(mdl);
return View();
   Â
UPDATE 2018-01-04
Added support to use local folder instead of using paid or free mail servers.
HOW TO USE ?
It is really simple to use. Just create MVCMailer model with pickup directory location. When you send the email make sure you set sender and reciver email. Once done, you can see email in your provided pickup directory.
MailerModel mdl = new MailerModel(**"Your Directory Here"**)
{
FromAddress = "Your Address",
IsHtml = true,
User = "YourUserName",
Key ="YourKey",
ViewFile = "Emails/Register",
Subject = "Registration",
Model = new // Your actual class model
{
}
};
mdl.ToAddresses.Add("test@test.com");
_mailer.Send(mdl);
LICENSE
CORE MAILER
Copyright (C) Since 2017, Riy Technologies AB.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.
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.1 is compatible. |
-
.NETCoreApp 3.1
- Microsoft.AspNetCore.Http.Features (>= 3.1.3)
- Microsoft.AspNetCore.Mvc.Razor.Extensions (>= 3.1.3)
- Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (>= 3.1.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.