Tudor Stanciu 2023-01-30 19:23:54 +02:00
commit 697f139625
6 changed files with 23 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<Project>
<Import Project="dependencies.props" />
<PropertyGroup>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Authors>Tudor Stanciu</Authors>
<Company>STA</Company>
<PackageTags>Correo</PackageTags>

View File

@ -57,17 +57,27 @@ For this integration, the setup is very simple. All you need is an API Key gener
}
```
## Database
The database is SQLite. It is created automatically at the first start of the service, if it is missing. The path where the database is stored can be configured as follows:
## 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:
```
"Workspace": "workspace",
"ConnectionStrings": {
"DatabaseConnection": "Data Source={Workspace}\\correo.db"
"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.

View File

@ -11,9 +11,9 @@ namespace Correo.Abstractions.Extensions
public static string Log(this EmailMessage message)
{
var msg = $"Email sent: Subject: {message.Subject}; From: {message.From.Address}; To: {message.To.Log()};";
if (message.Cc != null)
if (message.Cc != null && message.Cc.Any())
msg += $" Cc: {message.Cc.Log()};";
if (message.Bcc != null)
if (message.Bcc != null && message.Bcc.Any())
msg += $" Bcc: {message.Bcc.Log()};";
return msg;
}

View File

@ -7,7 +7,7 @@ namespace Correo.Mailgun.Extensions
internal static class ModelExtensions
{
public static string ToMailgunAddress(this EmailMessage.MailAddress address)
=> $"{address.DisplayName} <{address.Address}>";
=> string.IsNullOrEmpty(address.DisplayName) ? address.Address : $"{address.DisplayName} <{address.Address}>";
public static string ToMailgunAddresses(this IEnumerable<EmailMessage.MailAddress> addresses)
{

View File

@ -13,6 +13,6 @@ namespace Correo.PublishedLanguage.Commands
public IEnumerable<MailAddress> Bcc { get; init; }
public bool IsBodyHtml { get; init; }
public record MailAddress(string Address, string DisplayName);
public record MailAddress(string Address, string DisplayName = null);
}
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<PackageIcon>correo.png</PackageIcon>
<Description>Correo published language</Description>
</PropertyGroup>