Bsixmail 1.0.0.1

dotnet add package Bsixmail --version 1.0.0.1
NuGet\Install-Package Bsixmail -Version 1.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bsixmail" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bsixmail --version 1.0.0.1
#r "nuget: Bsixmail, 1.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Bsixmail as a Cake Addin
#addin nuget:?package=Bsixmail&version=1.0.0.1

// Install Bsixmail as a Cake Tool
#tool nuget:?package=Bsixmail&version=1.0.0.1

Mailer template and helper for asp.net webform or mvc .net framework 4.0 or above

First step you need to add and edit this in your web.config

  <system.net>
      <mailSettings>
          <smtp from="yourmail@yourmail.com">
              <network enableSsl="true" host="smtp.gmail.com" port="587" userName="yourmail@yourmail.com" password="yourpassword"/>
      </smtp>
    </mailSettings>
  </system.net>

Lets call the bsixmail inside your contoller or method

var mailer = new BsixMailer();

Now you can use it, see the examples below :

This is for send on the fly. Variable _Base just optional if you want to configure approval, you need to configure your domain, so public can access your public url not your localhost

 var _Base = "https://yourdomain.com/controller/action";         
mailer.BuildBody(new
{
  Message = "hello from bsix aproval",
  UrlApprove = string.Format("{0}/{1}/{2}", _Base, "Approve", "yes"),
  UrlReject = string.Format("{0}/{1}/{2}", _Base, "Approve", "no") 
}, "default.txt") // Your template mail located inside BsixMail folder
.EmailTo("mailto@example.com")
.EmailSubject("This is subject")
.Send();

Sending mail in background task

mailer.BuildBody(new
{
  Message = "hello from bsix" // You can bind this with your model, its just example
}, "default.txt")  // Your template mail located inside BsixMail folder
.EmailTo("mailto@example.com")
.EmailSubject("This is subject")
.SendBackground();

You can add or edit default.txt with your own template, and bind it to your model, example

public class Mymodel 
{
  public string Name {get; set;}
}

Then your defaul.txt or mytemplate.html which is you just created with your own inside BsixMail Folder example template

Hi {{Name}} i`m from Bsixmail

And see how to use it

var myModel =  new Mymodel() { Name = "Ihsan" };

mailer.BuildBody(myModel, "mytemplate.txt")  // Your template mail located inside BsixMail folder
.EmailTo("mailto@example.com")
.EmailSubject("This is subject")
.SendBackground();

You also can trace if email not sent in BsixMail folder

If you want to take a look the source https://github.com/ihsanbsix/Bsix-MailSender

Thats it

Need help? just go to github repo and create issue

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.

Version Downloads Last updated
1.0.0.1 553 12/10/2019
1.0.0 482 12/10/2019

Summary of changes made in this release of the package.