Correo is a .NET service for programmatically sending emails
 
 
Go to file
Tudor Stanciu f6a9230d85 readme update 2023-01-26 21:42:18 +02:00
src config update 2023-01-24 19:44:36 +02:00
.dockerignore add docker support 2023-01-21 16:16:20 +02:00
.gitattributes Add .gitattributes, .gitignore, README.md, and LICENSE.txt. 2023-01-17 23:14:03 +02:00
.gitignore gitignore update 2023-01-21 16:51:16 +02:00
Correo.sln dockerfile update 2023-01-21 18:28:07 +02:00
Directory.Build.props Directory.Build.props 2023-01-21 18:27:27 +02:00
LICENSE.txt Add .gitattributes, .gitignore, README.md, and LICENSE.txt. 2023-01-17 23:14:03 +02:00
README.md readme update 2023-01-26 21:42:18 +02:00
dependencies.props Logging improvements 2023-01-24 19:40:32 +02:00
nuget.config nuget.config file 2023-01-17 23:25:50 +02:00

README.md

Correo

Correo is a .NET service for programmatically sending emails. Communication with this service is available through two channels simultaneously:

  • HTTP (via REST API)
  • Pub/Sub Messaging (via NATS)

It can be integrated with several types of mediators, the configuration being the following:

"SmtpMediator": "SmtpClient", //SmtpClient, SendGrid, Mailgun

Mediators

SMTP servers:

  • Local servers
  • Gmail
  • Yahoo

The integration with SMTP servers can be done through two libraries (.NET / MailKit), and the configuration area looks like this:

"SmtpClient": {
  "Package": "MailKit", //.NET, MailKit
  "Server": "smtp.gmail.com",
  "Port": "587",
  "UseAuthentication": true,
  "Authentication": {
    "UserName": "<account>@gmail.com",
    "Domain": "",
    "Password": "********"
  },
  "EnableSsl": true,
  "TrustServer": false
}

Transactional Email APIs:

SendGrid

SendGrid is a cloud-based SMTP provider that allows you to send emails without having to maintain email servers. It has an excellent and easy-to-use email API with a free plan that allows you to send 100 emails per day. For this integration, the setup is very simple. All you need is an API Key generated from the SendGrid platform. Afterwards, this API Key will be configured in Correo as below:

"SmtpMediator": "SendGrid"
"SendGrid": {
  "ApiKey": "xxxxxxxxxxx"
}

Mailgun

Mailgun is an email automation service that allows you to send, receive, and track emails. It offers a free usage plan as well as a pay-as-you-go pricing model that is based on the number of emails sent per month. For this integration, the setup is very simple. All you need is an API Key generated from the Mailgun platform and the domain name configured in Mailgun. Afterwards, this keys will be configured in Correo as below:

"SmtpMediator": "Mailgun"
"Mailgun": {
  "ApiKey": "xxxxxxxxxxx",
  "Domain": "xxxxxxxxxxx"
}

Logging

The logging functionality is managed with Serilog, and its configuration is done in the appsettings.json file. In addition to its standard configuration, Correo also has a preconfigured area where three destinations for logs are available: file, Postgres database and Seq. Each of the destinations can be activated or not. If logging in the console is sufficient, all additional logging destinations can be disabled. This configuration area is:

"Logs": {
  "File": {
    "Enabled": false,
    "Path": "logs/log.txt"
  },
  "Postgres": {
    "Enabled": false,
    "Connection": "Host=<host>;Port=5432;User ID=<user>;Password=<password>;Database=<database>;"
  },
  "Seq": {
    "Enabled": false,
    "Url": "",
    "ApiKey": ""
  }
}

For the moment, the only purpose of the database is to store the logs generated by Serilog.

Hosting

The only hosting environment tested for this service is Docker, but considering that .NET 6 is cross platform, it can most likely be hosted in any environment.