Skip to content

trenoncourt/AutoMail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automail · NuGet PRs Welcome GitHub license Donate

A tiny .net core microservice to send mails ready in 30 seconds.

AutoMail is a tiny API to send mails based on the MailKit library.

Installation

Choose between middleware or api

Middleware

Install-Package Automail.AspNetCore

Api

Download the last release, drop it to your server and that's it!

Configuration

All the configuration can be made in environment variable or appsettings.json file

"Automail": {
  "Providers": [
    {
      "Smtp": {
        "Host": "smtp.abc.com", // Required
        "Port": "587", // Required
        "User": "trenoncourt@abc.com",
        "Password": "Secret",
        "Security": "Tls"
      }
    },
    {
      "Path": "xyz", // Can be ommited for 1 endpoint, empty per default
      "Smtp": {
        "Host": "smtp.xyz.com",
        "Port": "587",
        "User": "trenoncourt@xyz.com",
        "Password": "Secret",
        "Security": "Tls",
        "LocalDomain": "HELO"
      }
    }
  ]
}

Api configuration

Cors

"Cors": {
  "Enabled": true, // default is false
  "Methods": "...", // default is *
  "Origins": "...", // default is *
  "Headers": "...", // default is *
}

Host

Currently only chose to use IIS integration

"Host": {
  "UseIis": true
}

Kestrel

Kestrel options, see ms doc for usage

"Kestrel": {
  "AddServerHeader": false
}

Serilog

storfiler use Serilog for logging, see serilog-settings-configuration for usage

"Serilog": {
  "MinimumLevel": {
    "Default": "Debug",
    "Override": {
      "Microsoft": "Warning",
      "System": "Warning"
    }
  },
  "WriteTo": [
    { "Name": "Console" }
  ],
  "Enrich": ["FromLogContext"]
}

API

POST /send

Sends an email.

JSON Body

{
  "from": "trenoncourt@abc.fr", // can be omitted if user is in settings
  "fromName": "thibaut renoncourt",
  "to": "trenoncourt@xyz.com", // required
  "subject": "your subject",
  "body": "your body",
  "cc": "cc@abc.fr",
  "isHtml": true
}

FORM-DATA Body

If you want to pass attachments

files: [attachments]

data: same as json body

Note: multiple adresses can be passed with ';' separator

Auth

Soon...

About

A tiny .net core microservice or middleware to send mails ready in 30 seconds.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages