Giter VIP home page Giter VIP logo

referbruv / mailingninja Goto Github PK

View Code? Open in Web Editor NEW
35.0 3.0 8.0 13.51 MB

MailingNinja is a simple boilerplate solution that demonstrates sending mails with attachments from an ASP.NET Core (.NET 6) application using MailKit and MimeKit.

Home Page: https://referbruv.com

License: MIT License

C# 75.27% HTML 21.27% CSS 2.85% JavaScript 0.61%
razor mvc mailkit mimekit dinktopdf asp-net-core aspnetcore clean-architecture cqrs

mailingninja's Introduction

.NET GitHub stars Twitter Follow

MailingNinja

MailingNinja is a simple boilerplate solution that demonstrates sending mails with attachments from an ASP.NET Core (.NET 6) application using MailKit and MimeKit.

Key Takeaways

The application demonstrates three key functionalities which are common in business applications.

  1. Generating HTML from Razor Views which are rendered with data using RazorViewEngine
  2. Generating a PDF report from HTML and downloading via ASP.NET Core (.NET 6) MVC using DinkToPdf
  3. Sending HTML content (with and without Attachments) from the application using MailKit and MimeKit

What is RazorViewEngine?

RazorViewEngine is a view engine that converts the razor powered cshtml files in an MVC application into plain HTML documents which the browser can understand. It takes care of the variable resolution, loops and other control structures of the Razor syntax and processes them to form the HTML only which the browser can render and display to the user.

For starters, An MVC application developed over the ASP.NET framework internally uses Razor to render html views and data over layout files during a request. Applications developed using ASP.NET can make use of an external library called RazorEngine which levarages the Razor engine capabilities of the MVC framework.

Although RazorEngine plugin has no direct support for ASP.NET Core, the aspnetcore framework still comes with the razor engine which provides helper methods which can by-produce the rendered HTML over the passed model data and return the plain HTML along.

What is DinkToPdf?

DinkToPdf is a .NET library which can generate PDF from an input content. The library offers customizations such as Page Layouts, Numbering, Headers, Footers and so on. We can pass in a HTML string to the library and it returns PDF bytes which can be further written onto a File.

The Solution offers the following:

  1. Demonstration of Generating Dynamic HTML content for input data through Razor Views
  2. Writing the generated dynamic HTML content into PDF and downloading it (through FileResult)
  3. Configuring SMTP and sending out the dynamic HTML content as an Email
  4. Sending out the generated PDF content as an attachment to the above sent Email
  5. CQRS with MediatR
  6. Repositories and UnitOfWork
  7. SQLite Database integration
  8. Clean Architecture with decoupled layers

Technologies

  1. ASP.NET Core (.NET 6)
  2. EF Core and SQLite
  3. MediatR
  4. MailKit and MimeKit
  5. DinkToPdf

Output

Dashboard Send Report Over Mail Mailed Content with Header PDF Attachment PDF Report

Resources

You can refer to the below articles to better understand the solution:

Support Me

For more detailed articles and how-to guides, visit https://referbruv.com

Liked my work? You can support me by buying me a coffee!

Buy Me A Coffee

mailingninja's People

Contributors

referbruv avatar sriramkumarm1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mailingninja's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.