JmpCoreMailer 1.1.8

Install-Package JmpCoreMailer -Version 1.1.8
dotnet add package JmpCoreMailer --version 1.1.8
<PackageReference Include="JmpCoreMailer" Version="1.1.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JmpCoreMailer --version 1.1.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: JmpCoreMailer, 1.1.8"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install JmpCoreMailer as a Cake Addin
#addin nuget:?package=JmpCoreMailer&version=1.1.8

// Install JmpCoreMailer as a Cake Tool
#tool nuget:?package=JmpCoreMailer&version=1.1.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

JmpCoreMailer

Send email from .NET Core 2.0 with razor template Check the example code for details 😃 happy coding

How to Use:

To Install

npm install JmpCoreMailer

In Startup.cs add

services.AddScoped<ITemplateRenderer, TemplateRenderer>();
services.AddScoped<ICoreMvcMailer, CoreMvcMailer>();

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
        {
        }
    };
}
        
// Enable SSL mail sending
_mailer.EnableSsl();
_mailer.Send(mdl);
return View();

       

UPDATE 2019-12-23

Added support to use local folder instead of using paid or free mail servers.

Added supporte to use SSL to send mails.

Method Mailer.SendAsync renamed - missing "c" at end of it.

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.EnableSsl();
_mailer.Send(mdl);

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.1.8 1,996 12/23/2019
1.1.7 218 12/23/2019
1.1.6 224 12/23/2019
1.1.5 238 12/23/2019
1.1.4 227 12/23/2019