diff --git a/Directory.Build.props b/Directory.Build.props index db94b97..9ea45ba 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - 1.0.0 + 1.0.1 Tudor Stanciu STA Correo diff --git a/README.md b/README.md index cfef000..ede41fa 100644 --- a/README.md +++ b/README.md @@ -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=;Port=5432;User ID=;Password=;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. \ No newline at end of file diff --git a/src/Correo.Abstractions/Extensions/ModelExtensions.cs b/src/Correo.Abstractions/Extensions/ModelExtensions.cs index 1b3658d..ca52c7c 100644 --- a/src/Correo.Abstractions/Extensions/ModelExtensions.cs +++ b/src/Correo.Abstractions/Extensions/ModelExtensions.cs @@ -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; } diff --git a/src/Correo.Mailgun/Extensions/ModelExtensions.cs b/src/Correo.Mailgun/Extensions/ModelExtensions.cs index ca29b08..81ff4c1 100644 --- a/src/Correo.Mailgun/Extensions/ModelExtensions.cs +++ b/src/Correo.Mailgun/Extensions/ModelExtensions.cs @@ -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 addresses) { diff --git a/src/Correo.PublishedLanguage/Commands/SendEmail.cs b/src/Correo.PublishedLanguage/Commands/SendEmail.cs index e30bd59..91ffe27 100644 --- a/src/Correo.PublishedLanguage/Commands/SendEmail.cs +++ b/src/Correo.PublishedLanguage/Commands/SendEmail.cs @@ -13,6 +13,6 @@ namespace Correo.PublishedLanguage.Commands public IEnumerable Bcc { get; init; } public bool IsBodyHtml { get; init; } - public record MailAddress(string Address, string DisplayName); + public record MailAddress(string Address, string DisplayName = null); } } diff --git a/src/Correo.PublishedLanguage/Correo.PublishedLanguage.csproj b/src/Correo.PublishedLanguage/Correo.PublishedLanguage.csproj index 611d228..b7b27e4 100644 --- a/src/Correo.PublishedLanguage/Correo.PublishedLanguage.csproj +++ b/src/Correo.PublishedLanguage/Correo.PublishedLanguage.csproj @@ -2,7 +2,7 @@ net6.0 - 1.0.0 + 1.0.1 correo.png Correo published language