GithubHelp home page GithubHelp logo

pedramp20 / mailservice Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 96 KB

A mail service which is consist of a frontend built using asp .net core plus angular and a backend built using asp .net core web api. It uses thirdparty mail api

C# 61.99% TypeScript 17.67% CSS 1.92% HTML 7.17% JavaScript 11.25%

mailservice's Introduction

MAil Service

Mail service is a simple email service that accepts the necessary information and sends emails. The front end of the service is implemented using Asp .Net Core + Angular and the back end is developed using Asp .Net Core Web API. A third-party email service API provider known as MailGun is integrated into the back-end to send it deliver emails to the requested recipients. The service also utilises a simple failover mechanism to gracefully fail over to another third-party service (Send Grid) when the primary service provider is unavailable.

Installing

Install .NET Core 2.1 or later

Install your favourite code editor such VS Code or IDE Visual Studio 2017

Prerequisites

Register your acounts on Mail Gun and Send Grid and update the respective values in appsettings.json file in MailService.Api project.

{
  "Logging": {
    "IncludeScopes": false,
    "Debug": {
      "LogLevel": {
        "Default": "Warning"
      }
    },
    "Console": {
      "LogLevel": {
        "Default": "Warning"
      }
    }
  },
  "MailServicesSecrets": {
    "MailGunServiceApiKey": "Enter Your API Key HERE",
    "SendGridServiceApiKey": "Enter Your API Key HERE"
  }
}

Finally update the values in the test fixture classes under the MailService.Api.Tests project.

 public SendGridMailServiceFixture()
        {
            var optionsMock = new Mock<IOptions<MailSecrets>>();
            optionsMock.Setup(o => o.Value).Returns(
                () => new MailSecrets
                          {
                              SendGridServiceApiKey =
                                  ">>Update Your Sed Grid Api Key<<"
                          });

            var config = new MapperConfiguration(cfg => { cfg.AddProfile(new DomainProfile()); });
            var mapper = config.CreateMapper();

            SendGridMailService = new SendGridMailService(optionsMock.Object, mapper);
        }

And update your api key value in MailGunMailServiceFixture

 public MailGunMailServiceFixture()
        {
            var optionsMock = new Mock<IOptions<MailSecrets>>();
            optionsMock.Setup(o => o.Value).Returns(
                () => new MailSecrets { MailGunServiceApiKey = ">>Update your mail gun Api key<<" });

            MailGunMailService = new MailGunMailService(optionsMock.Object);
        }

Running the projects

Right click on the solution and select properties. Under Startup project select "multiple setup projects" and from the list choose MailService.Api and MailService.Consumer and press ok.

Try the project

Run the projects and give it a try. You should be able to see a single page web app designed to compose and send emails.

Authors

  • Pedram Pourashraf

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • AutoMapper
  • FluentAssertions
  • Moq
  • PactNet
  • XUnit

mailservice's People

Contributors

pedramp20 avatar

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.