All Projects → lukencode → Fluentemail

lukencode / Fluentemail

Licence: mit
All in one email sender for .NET. Supports popular senders (SendGrid, MailGun, etc) and Razor templates.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Fluentemail

Mailer
A light-weight, modular, message representation and mail delivery framework for Python.
Stars: ✭ 225 (-88.08%)
Mutual labels:  email, smtp, sendgrid, mailgun
Magento2 Gmail Smtp App
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers
Stars: ✭ 281 (-85.12%)
Mutual labels:  email, smtp, sendgrid, mailgun
Django Anymail
Django email backends and webhooks for Amazon SES, Mailgun, Mailjet, Postmark, SendGrid, Sendinblue, SparkPost and more
Stars: ✭ 1,109 (-41.26%)
Mutual labels:  email, sendgrid, mailgun
Mailcore
Emailing wrapper for Vapor 3 apps
Stars: ✭ 77 (-95.92%)
Mutual labels:  smtp, sendgrid, mailgun
Sendgrid Csharp
The Official Twilio SendGrid Led, Community Driven C#, .NetStandard, .NetCore API Library
Stars: ✭ 835 (-55.77%)
Mutual labels:  email, sendgrid, dotnetcore
go-mail
📧 A cross platform mail driver for GoLang. Featuring Mailgun, Postal, Postmark, SendGrid, SparkPost & SMTP.
Stars: ✭ 169 (-91.05%)
Mutual labels:  mailgun, smtp, sendgrid
Omnimail
Send email across all platforms using one interface
Stars: ✭ 325 (-82.79%)
Mutual labels:  email, sendgrid, mailgun
mailcoach-support
Questions and support for Mailcoach
Stars: ✭ 32 (-98.31%)
Mutual labels:  mailgun, smtp, sendgrid
wemail
Send Affordable Bulk Email Campaign Through WordPress
Stars: ✭ 19 (-98.99%)
Mutual labels:  mailgun, smtp, sendgrid
Airform
Functional HTML forms for Front-End Developers.
Stars: ✭ 307 (-83.74%)
Mutual labels:  smtp, sendgrid, mailgun
Notify
A dead simple Go library for sending notifications to various messaging services.
Stars: ✭ 727 (-61.49%)
Mutual labels:  email, sendgrid, mailgun
Dialogflow Sendgrid
📮 Dialogflow + Sendgrid = AI Mailbox
Stars: ✭ 33 (-98.25%)
Mutual labels:  email, sendgrid
Wp Phpmailer
Provides a clean and simple way to configure the WordPress-bundled PHPMailer library, allowing you to quickly get started sending mail through a local or cloud based service of your choice
Stars: ✭ 46 (-97.56%)
Mutual labels:  smtp, sendgrid
Mailer
A lightweight PHP SMTP mail sender
Stars: ✭ 53 (-97.19%)
Mutual labels:  email, smtp
Sendria
Sendria (formerly MailTrap) is a SMTP server designed to run in your dev/test environment, that is designed to catch any email you or your application is sending, and display it in a web interface instead of sending to real world.
Stars: ✭ 30 (-98.41%)
Mutual labels:  email, smtp
Sendgrid Python
The Official Twilio SendGrid Led, Community Driven Python API Library
Stars: ✭ 1,125 (-40.41%)
Mutual labels:  email, sendgrid
Tcpbin
Very crude and poorly written HTTP(s) and SMTP bin
Stars: ✭ 85 (-95.5%)
Mutual labels:  email, smtp
Mailinabox
Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
Stars: ✭ 10,649 (+464.04%)
Mutual labels:  email, smtp
Mailgun
📧 Service to assist with sending emails from Vapor apps
Stars: ✭ 82 (-95.66%)
Mutual labels:  email, mailgun
Sendgrid Php
The Official Twilio SendGrid Led, Community Driven PHP API Library
Stars: ✭ 1,257 (-33.42%)
Mutual labels:  email, sendgrid

alt text

FluentEmail - All in one email sender for .NET and .NET Core

The easiest way to send email from .NET and .NET Core. Use Razor for email templates and send using SendGrid, MailGun, SMTP and more.

Maintained by Luke Lowrey - follow me on twitter @lukencode for updates. See my blog for a detailed guide A complete guide to send email in .NET

Nuget Packages

Core Library

  • FluentEmail.Core - Just the domain model. Includes very basic defaults, but is also included with every other package here.
  • FluentEmail.Smtp - Send email via SMTP server.

Renderers

Mail Provider Integrations

Basic Usage

var email = await Email
    .From("[email protected]")
    .To("[email protected]", "bob")
    .Subject("hows it going bob")
    .Body("yo bob, long time no see!")
    .SendAsync();

Dependency Injection

Configure FluentEmail in startup.cs with these helper methods. This will inject IFluentEmail (send a single email) and IFluentEmailFactory (used to send multiple emails in a single context) with the ISender and ITemplateRenderer configured using AddRazorRenderer(), AddSmtpSender() or other packages.

public void ConfigureServices(IServiceCollection services)
{
    services
        .AddFluentEmail("[email protected]")
        .AddRazorRenderer()
        .AddSmtpSender("localhost", 25);
}

Using a Razor template

// Using Razor templating package (or set using AddRazorRenderer in services)
Email.DefaultRenderer = new RazorRenderer();

var template = "Dear @Model.Name, You are totally @Model.Compliment.";

var email = Email
    .From("[email protected]")
    .To("[email protected]")
    .Subject("woo nuget")
    .UsingTemplate(template, new { Name = "Luke", Compliment = "Awesome" });

Using a Liquid template

Liquid templates are a more secure option for Razor templates as they run in more restricted environment. While Razor templates have access to whole power of CLR functionality like file access, they also are more insecure if templates come from untrusted source. Liquid templates also have the benefit of being faster to parse initially as they don't need heavy compilation step like Razor templates do.

Model properties are exposed directly as properties in Liquid templates so they also become more compact.

See Fluid samples for more examples.

// Using Liquid templating package (or set using AddLiquidRenderer in services)

// file provider is used to resolve layout files if they are in use
var fileProvider = new PhysicalFileProvider(Path.Combine(someRootPath, "EmailTemplates"));
var options = new LiquidRendererOptions
{
    FileProvider = fileProvider
};

Email.DefaultRenderer = new LiquidRenderer(Options.Create(options));

// template which utilizes layout
var template = @"
{% layout '_layout.liquid' %}
Dear {{ Name }}, You are totally {{ Compliment }}.";

var email = Email
    .From("[email protected]")
    .To("[email protected]")
    .Subject("woo nuget")
    .UsingTemplate(template, new ViewModel { Name = "Luke", Compliment = "Awesome" });

Sending Emails

// Using Smtp Sender package (or set using AddSmtpSender in services)
Email.DefaultSender = new SmtpSender();

//send normally
email.Send();

//send asynchronously
await email.SendAsync();

Template File from Disk

var email = Email
    .From("[email protected]")
    .To("[email protected]")
    .Subject("woo nuget")
    .UsingTemplateFromFile($"{Directory.GetCurrentDirectory()}/Mytemplate.cshtml", new { Name = "Rad Dude" });

Embedded Template File

Note for .NET Core 2 users: You'll need to add the following line to the project containing any embedded razor views. See this issue for more details.

<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
var email = new Email("[email protected]")
	.To("[email protected]")
	.Subject("Hey cool name!")
	.UsingTemplateFromEmbedded("Example.Project.Namespace.template-name.cshtml", 
		new { Name = "Bob" }, 
		TypeFromYourEmbeddedAssembly.GetType().GetTypeInfo().Assembly);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].