1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00

SendGrid Mail Delivery Provider (#1892)

* add sendgrid mail delivery service

* <

* remove duplicate code

* fix test by using ISendGridClient interface
This commit is contained in:
Kyle Spearrin 2022-03-01 19:09:51 -05:00 committed by GitHub
parent 5dd6a05615
commit 4cbe05da3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 741 additions and 279 deletions

View File

@ -1447,6 +1447,15 @@
"resolved": "4.3.2",
"contentHash": "leXiwfiIkW7Gmn7cgnNcdtNAU70SjmKW3jxGj1iKHOvdn0zRWsgv/l2OJUO5zdGdiv2VRFnAsxxhDgMzofPdWg=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1662,6 +1671,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3188,6 +3202,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",

View File

@ -1643,6 +1643,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1858,6 +1867,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3369,6 +3383,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3383,7 +3398,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3392,7 +3407,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3402,9 +3417,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1744,6 +1744,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1959,6 +1968,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3518,27 +3532,27 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"common": {
"type": "Project",
"dependencies": {
"Api": "1.46.0",
"Api": "1.46.2",
"AutoFixture.AutoNSubstitute": "4.14.0",
"AutoFixture.Xunit2": "4.14.0",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.NET.Test.Sdk": "16.6.1",
"NSubstitute": "4.2.2",
"xunit": "2.4.1"
@ -3571,6 +3585,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3585,11 +3600,11 @@
"core.test": {
"type": "Project",
"dependencies": {
"Api": "1.46.0",
"Api": "1.46.2",
"AutoFixture.AutoNSubstitute": "4.14.0",
"AutoFixture.Xunit2": "4.14.0",
"Common": "1.46.0",
"Core": "1.46.0",
"Common": "1.46.2",
"Core": "1.46.2",
"Microsoft.NET.Test.Sdk": "16.6.1",
"Moq": "4.16.1",
"NSubstitute": "4.2.2",
@ -3599,7 +3614,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3608,7 +3623,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3618,9 +3633,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1692,6 +1692,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1907,6 +1916,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3408,7 +3422,7 @@
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"core": {
@ -3438,6 +3452,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3452,7 +3467,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3461,7 +3476,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3471,7 +3486,7 @@
"migrator": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.Extensions.Logging": "5.0.0",
"dbup-sqlserver": "4.4.0"
}
@ -3479,9 +3494,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1629,6 +1629,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1844,6 +1853,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3347,7 +3361,7 @@
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"core": {
@ -3377,6 +3391,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3391,7 +3406,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3400,7 +3415,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3410,9 +3425,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1661,6 +1661,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1876,6 +1885,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3401,6 +3415,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3415,7 +3430,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3424,7 +3439,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3434,9 +3449,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -37,6 +37,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.9" />
<PackageReference Include="Quartz" Version="3.1.0" />
<PackageReference Include="SendGrid" Version="9.25.3" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="2.0.0" />

View File

@ -1,5 +1,4 @@
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Bit.Core.Models.Mail;
using Bit.Core.Settings;
@ -11,32 +10,30 @@ namespace Bit.Core.Services
public class MultiServiceMailDeliveryService : IMailDeliveryService
{
private readonly IMailDeliveryService _sesService;
private readonly IMailDeliveryService _postalService;
private readonly int _postalPercentage;
private readonly IMailDeliveryService _sendGridService;
private readonly int _sendGridPercentage;
private static Random _random = new Random();
public MultiServiceMailDeliveryService(
GlobalSettings globalSettings,
IWebHostEnvironment hostingEnvironment,
IHttpClientFactory httpClientFactory,
ILogger<AmazonSesMailDeliveryService> sesLogger,
ILogger<PostalMailDeliveryService> postalLogger)
ILogger<SendGridMailDeliveryService> sendGridLogger)
{
_sesService = new AmazonSesMailDeliveryService(globalSettings, hostingEnvironment, sesLogger);
_postalService = new PostalMailDeliveryService(globalSettings, postalLogger, hostingEnvironment,
httpClientFactory);
_sendGridService = new SendGridMailDeliveryService(globalSettings, hostingEnvironment, sendGridLogger);
// 2% by default
_postalPercentage = (globalSettings.Mail?.PostalPercentage).GetValueOrDefault(2);
// disabled by default (-1)
_sendGridPercentage = (globalSettings.Mail?.SendGridPercentage).GetValueOrDefault(-1);
}
public async Task SendEmailAsync(MailMessage message)
{
var roll = _random.Next(0, 99);
if (roll < _postalPercentage)
if (roll < _sendGridPercentage)
{
await _postalService.SendEmailAsync(message);
await _sendGridService.SendEmailAsync(message);
}
else
{

View File

@ -1,116 +0,0 @@
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
namespace Bit.Core.Services
{
public class PostalMailDeliveryService : IMailDeliveryService
{
private readonly GlobalSettings _globalSettings;
private readonly ILogger<PostalMailDeliveryService> _logger;
private readonly IHttpClientFactory _clientFactory;
private readonly string _baseTag;
private readonly string _from;
private readonly string _reply;
public PostalMailDeliveryService(
GlobalSettings globalSettings,
ILogger<PostalMailDeliveryService> logger,
IWebHostEnvironment hostingEnvironment,
IHttpClientFactory clientFactory)
{
var postalDomain = CoreHelpers.PunyEncode(globalSettings.Mail.PostalDomain);
var replyToEmail = CoreHelpers.PunyEncode(globalSettings.Mail.ReplyToEmail);
_globalSettings = globalSettings;
_logger = logger;
_clientFactory = clientFactory;
_baseTag = $"Env_{hostingEnvironment.EnvironmentName}-" +
$"Server_{globalSettings.ProjectName?.Replace(' ', '_')}";
_from = $"\"{globalSettings.SiteName}\" <no-reply@{postalDomain}>";
_reply = $"\"{globalSettings.SiteName}\" <{replyToEmail}>";
}
public async Task SendEmailAsync(Models.Mail.MailMessage message)
{
var httpClient = _clientFactory.CreateClient("PostalMailDeliveryService");
httpClient.DefaultRequestHeaders.Add("X-Server-API-Key", _globalSettings.Mail.PostalApiKey);
var request = new PostalRequest
{
subject = message.Subject,
from = _from,
reply_to = _reply,
html_body = message.HtmlContent,
to = new List<string>(),
tag = _baseTag
};
foreach (var address in message.ToEmails)
{
request.to.Add(CoreHelpers.PunyEncode(address));
}
if (message.BccEmails != null)
{
request.bcc = new List<string>();
foreach (var address in message.BccEmails)
{
request.bcc.Add(CoreHelpers.PunyEncode(address));
}
}
if (!string.IsNullOrWhiteSpace(message.TextContent))
{
request.plain_body = message.TextContent;
}
if (!string.IsNullOrWhiteSpace(message.Category))
{
request.tag = string.Concat(request.tag, "-Cat_", message.Category);
}
var responseMessage = await httpClient.PostAsJsonAsync(
$"https://{_globalSettings.Mail.PostalDomain}/api/v1/send/message",
request);
if (responseMessage.IsSuccessStatusCode)
{
var response = await responseMessage.Content.ReadFromJsonAsync<PostalResponse>();
if (response.status != "success")
{
_logger.LogError("Postal send status was not successful: {0}, {1}",
response.status, response.message);
}
}
else
{
_logger.LogError("Postal send failed: {0}", responseMessage.StatusCode);
}
}
public class PostalRequest
{
public List<string> to { get; set; }
public List<string> cc { get; set; }
public List<string> bcc { get; set; }
public string tag { get; set; }
public string from { get; set; }
public string reply_to { get; set; }
public string plain_body { get; set; }
public string html_body { get; set; }
public string subject { get; set; }
}
public class PostalResponse
{
public string status { get; set; }
public string message { get; set; }
}
}
}

View File

@ -0,0 +1,118 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using Bit.Core.Models.Mail;
using Bit.Core.Settings;
using Bit.Core.Utilities;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using SendGrid;
using SendGrid.Helpers.Mail;
namespace Bit.Core.Services
{
public class SendGridMailDeliveryService : IMailDeliveryService, IDisposable
{
private readonly GlobalSettings _globalSettings;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ILogger<SendGridMailDeliveryService> _logger;
private readonly ISendGridClient _client;
private readonly string _senderTag;
private readonly string _replyToEmail;
public SendGridMailDeliveryService(
GlobalSettings globalSettings,
IWebHostEnvironment hostingEnvironment,
ILogger<SendGridMailDeliveryService> logger)
: this(new SendGridClient(globalSettings.Mail.SendGridApiKey),
globalSettings, hostingEnvironment, logger)
{
}
public void Dispose()
{
// TODO: nothing to dispose
}
public SendGridMailDeliveryService(
ISendGridClient client,
GlobalSettings globalSettings,
IWebHostEnvironment hostingEnvironment,
ILogger<SendGridMailDeliveryService> logger)
{
if (string.IsNullOrWhiteSpace(globalSettings.Mail?.SendGridApiKey))
{
throw new ArgumentNullException(nameof(globalSettings.Mail.SendGridApiKey));
}
_globalSettings = globalSettings;
_hostingEnvironment = hostingEnvironment;
_logger = logger;
_client = client;
_senderTag = $"Server_{globalSettings.ProjectName?.Replace(' ', '_')}";
_replyToEmail = CoreHelpers.PunyEncode(globalSettings.Mail.ReplyToEmail);
}
public async Task SendEmailAsync(MailMessage message)
{
var msg = new SendGridMessage();
msg.SetFrom(new EmailAddress(_replyToEmail, _globalSettings.SiteName));
msg.AddTos(message.ToEmails.Select(e => new EmailAddress(CoreHelpers.PunyEncode(e))).ToList());
if (message.BccEmails?.Any() ?? false)
{
msg.AddBccs(message.BccEmails.Select(e => new EmailAddress(CoreHelpers.PunyEncode(e))).ToList());
}
msg.SetSubject(message.Subject);
msg.AddContent(MimeType.Text, message.TextContent);
msg.AddContent(MimeType.Html, message.HtmlContent);
msg.AddCategory($"type:{message.Category}");
msg.AddCategory($"env:{_hostingEnvironment.EnvironmentName}");
msg.AddCategory($"sender:{_senderTag}");
msg.SetClickTracking(false, false);
msg.SetOpenTracking(false);
if (message.MetaData != null &&
message.MetaData.ContainsKey("SendGridBypassListManagement") &&
Convert.ToBoolean(message.MetaData["SendGridBypassListManagement"]))
{
msg.SetBypassListManagement(true);
}
try
{
var success = await SendAsync(msg, false);
if (!success)
{
_logger.LogWarning("Failed to send email. Retrying...");
await SendAsync(msg, true);
}
}
catch (Exception e)
{
_logger.LogWarning(e, "Failed to send email (with exception). Retrying...");
await SendAsync(msg, true);
throw;
}
}
private async Task<bool> SendAsync(SendGridMessage message, bool retry)
{
if (retry)
{
// wait and try again
await Task.Delay(2000);
}
var response = await _client.SendEmailAsync(message);
if (!response.IsSuccessStatusCode)
{
var responseBody = await response.Body.ReadAsStringAsync();
_logger.LogError("SendGrid email sending failed with {0}: {1}", response.StatusCode, responseBody);
}
return response.IsSuccessStatusCode;
}
}
}

View File

@ -280,9 +280,8 @@ namespace Bit.Core.Settings
public string ReplyToEmail { get; set; }
public string AmazonConfigSetName { get; set; }
public SmtpSettings Smtp { get; set; } = new SmtpSettings();
public string PostalDomain { get; set; }
public string PostalApiKey { get; set; }
public int? PostalPercentage { get; set; }
public string SendGridApiKey { get; set; }
public int? SendGridPercentage { get; set; }
public class SmtpSettings
{

View File

@ -247,6 +247,16 @@
"System.Diagnostics.DiagnosticSource": "4.7.1"
}
},
"SendGrid": {
"type": "Direct",
"requested": "[9.25.3, )",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry.Serilog": {
"type": "Direct",
"requested": "[2.1.5, )",
@ -1718,6 +1728,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"System.AppContext": {
"type": "Transitive",
"resolved": "4.3.0",

View File

@ -1589,6 +1589,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1804,6 +1813,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3310,6 +3324,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3324,7 +3339,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3333,7 +3348,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3343,9 +3358,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1583,6 +1583,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1798,6 +1807,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3304,6 +3318,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3318,7 +3333,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3327,7 +3342,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3337,9 +3352,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1592,6 +1592,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1807,6 +1816,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3313,6 +3327,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3327,7 +3342,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3336,7 +3351,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3346,9 +3361,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1589,6 +1589,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1804,6 +1813,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3310,6 +3324,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3324,7 +3339,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3333,7 +3348,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3343,9 +3358,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1489,6 +1489,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1704,6 +1713,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3230,6 +3244,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",

View File

@ -1558,6 +1558,15 @@
"resolved": "4.3.2",
"contentHash": "leXiwfiIkW7Gmn7cgnNcdtNAU70SjmKW3jxGj1iKHOvdn0zRWsgv/l2OJUO5zdGdiv2VRFnAsxxhDgMzofPdWg=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1773,6 +1782,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3269,6 +3283,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",

View File

@ -1657,6 +1657,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1883,6 +1892,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3404,6 +3418,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3418,7 +3433,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3427,7 +3442,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3437,9 +3452,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -156,8 +156,7 @@ namespace Bit.SharedWeb.Utilities
}
var awsConfigured = CoreHelpers.SettingHasValue(globalSettings.Amazon?.AccessKeySecret);
if (!globalSettings.SelfHosted && awsConfigured &&
CoreHelpers.SettingHasValue(globalSettings.Mail?.PostalApiKey))
if (awsConfigured && CoreHelpers.SettingHasValue(globalSettings.Mail?.SendGridApiKey))
{
services.AddSingleton<IMailDeliveryService, MultiServiceMailDeliveryService>();
}

View File

@ -1583,6 +1583,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1798,6 +1807,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3304,6 +3318,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3318,7 +3333,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3327,7 +3342,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",

View File

@ -1737,6 +1737,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1952,6 +1961,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3511,27 +3525,27 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"common": {
"type": "Project",
"dependencies": {
"Api": "1.46.0",
"Api": "1.46.2",
"AutoFixture.AutoNSubstitute": "4.14.0",
"AutoFixture.Xunit2": "4.14.0",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.NET.Test.Sdk": "16.6.1",
"NSubstitute": "4.2.2",
"xunit": "2.4.1"
@ -3564,6 +3578,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3578,7 +3593,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3587,7 +3602,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3597,9 +3612,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1809,6 +1809,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -2024,6 +2033,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3602,36 +3616,36 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"billing": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.VisualStudio.Web.CodeGeneration.Design": "5.0.2",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0"
"SharedWeb": "1.46.2"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"common": {
"type": "Project",
"dependencies": {
"Api": "1.46.0",
"Api": "1.46.2",
"AutoFixture.AutoNSubstitute": "4.14.0",
"AutoFixture.Xunit2": "4.14.0",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.NET.Test.Sdk": "16.6.1",
"NSubstitute": "4.2.2",
"xunit": "2.4.1"
@ -3664,6 +3678,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3678,7 +3693,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3687,7 +3702,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3697,9 +3712,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1732,6 +1732,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1947,6 +1956,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3506,18 +3520,18 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"core": {
@ -3547,6 +3561,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3561,7 +3576,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3570,7 +3585,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3580,9 +3595,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Bit.Core.Models.Mail;
using Bit.Core.Services;
using Bit.Core.Settings;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using NSubstitute;
using SendGrid;
using SendGrid.Helpers.Mail;
using Xunit;
namespace Bit.Core.Test.Services
{
public class SendGridMailDeliveryServiceTests : IDisposable
{
private readonly SendGridMailDeliveryService _sut;
private readonly GlobalSettings _globalSettings;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly ILogger<SendGridMailDeliveryService> _logger;
private readonly ISendGridClient _sendGridClient;
public SendGridMailDeliveryServiceTests()
{
_globalSettings = new GlobalSettings
{
Mail =
{
SendGridApiKey = "SendGridApiKey"
}
};
_hostingEnvironment = Substitute.For<IWebHostEnvironment>();
_logger = Substitute.For<ILogger<SendGridMailDeliveryService>>();
_sendGridClient = Substitute.For<ISendGridClient>();
_sut = new SendGridMailDeliveryService(
_sendGridClient,
_globalSettings,
_hostingEnvironment,
_logger
);
}
public void Dispose()
{
_sut?.Dispose();
}
[Fact]
public async Task SendEmailAsync_CallsSendEmailAsync_WhenMessageIsValid()
{
var mailMessage = new MailMessage
{
ToEmails = new List<string> { "ToEmails" },
BccEmails = new List<string> { "BccEmails" },
Subject = "Subject",
HtmlContent = "HtmlContent",
TextContent = "TextContent",
Category = "Category"
};
_sendGridClient.SendEmailAsync(Arg.Any<SendGridMessage>()).Returns(
new Response(System.Net.HttpStatusCode.OK, null, null));
await _sut.SendEmailAsync(mailMessage);
await _sendGridClient.Received(1).SendEmailAsync(
Arg.Do<SendGridMessage>(msg =>
{
msg.Received(1).AddTos(new List<EmailAddress> { new EmailAddress(mailMessage.ToEmails.First()) });
msg.Received(1).AddBccs(new List<EmailAddress> { new EmailAddress(mailMessage.ToEmails.First()) });
Assert.Equal(mailMessage.Subject, msg.Subject);
Assert.Equal(mailMessage.HtmlContent, msg.HtmlContent);
Assert.Equal(mailMessage.TextContent, msg.PlainTextContent);
Assert.Contains("type:Cateogry", msg.Categories);
Assert.Contains(msg.Categories, x => x.StartsWith("env:"));
Assert.Contains(msg.Categories, x => x.StartsWith("sender:"));
msg.Received(1).SetClickTracking(false, false);
msg.Received(1).SetOpenTracking(false);
}));
}
}
}

View File

@ -1748,6 +1748,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1963,6 +1972,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3522,27 +3536,27 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"common": {
"type": "Project",
"dependencies": {
"Api": "1.46.0",
"Api": "1.46.2",
"AutoFixture.AutoNSubstitute": "4.14.0",
"AutoFixture.Xunit2": "4.14.0",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.NET.Test.Sdk": "16.6.1",
"NSubstitute": "4.2.2",
"xunit": "2.4.1"
@ -3575,6 +3589,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3589,7 +3604,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3598,7 +3613,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3608,9 +3623,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1678,6 +1678,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1893,6 +1902,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3443,6 +3457,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3458,14 +3473,14 @@
"type": "Project",
"dependencies": {
"AngleSharp": "0.14.0",
"Core": "1.46.0",
"SharedWeb": "1.46.0"
"Core": "1.46.2",
"SharedWeb": "1.46.2"
}
},
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3474,7 +3489,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3484,9 +3499,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1737,6 +1737,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1952,6 +1961,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3511,27 +3525,27 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"common": {
"type": "Project",
"dependencies": {
"Api": "1.46.0",
"Api": "1.46.2",
"AutoFixture.AutoNSubstitute": "4.14.0",
"AutoFixture.Xunit2": "4.14.0",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.NET.Test.Sdk": "16.6.1",
"NSubstitute": "4.2.2",
"xunit": "2.4.1"
@ -3564,6 +3578,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3578,15 +3593,15 @@
"identity": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0"
"SharedWeb": "1.46.2"
}
},
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3595,7 +3610,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3605,9 +3620,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1495,6 +1495,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1710,6 +1719,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3247,6 +3261,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",

View File

@ -1630,6 +1630,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1845,6 +1854,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3360,18 +3374,18 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"core": {
@ -3401,6 +3415,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3415,7 +3430,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3424,7 +3439,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3434,9 +3449,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1630,6 +1630,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1845,6 +1854,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3360,18 +3374,18 @@
"type": "Project",
"dependencies": {
"Azure.Messaging.EventGrid": "4.7.0",
"CommCore": "1.46.0",
"Core": "1.46.0",
"CommCore": "1.46.2",
"Core": "1.46.2",
"Microsoft.AspNetCore.Mvc.NewtonsoftJson": "5.0.9",
"NewRelic.Agent": "8.41.0",
"SharedWeb": "1.46.0",
"SharedWeb": "1.46.2",
"Swashbuckle.AspNetCore": "6.2.3"
}
},
"commcore": {
"type": "Project",
"dependencies": {
"Core": "1.46.0"
"Core": "1.46.2"
}
},
"core": {
@ -3401,6 +3415,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3415,7 +3430,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Dapper": "2.0.123",
"System.Data.SqlClient": "4.8.3"
}
@ -3424,7 +3439,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "8.0.1",
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.EntityFrameworkCore.Relational": "5.0.12",
"Npgsql.EntityFrameworkCore.PostgreSQL": "5.0.2",
"Pomelo.EntityFrameworkCore.MySql": "5.0.3",
@ -3434,9 +3449,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Infrastructure.Dapper": "1.46.0",
"Infrastructure.EntityFramework": "1.46.0"
"Core": "1.46.2",
"Infrastructure.Dapper": "1.46.2",
"Infrastructure.EntityFramework": "1.46.2"
}
}
}

View File

@ -1501,6 +1501,15 @@
"resolved": "4.4.0",
"contentHash": "YhEdSQUsTx+C8m8Bw7ar5/VesXvCFMItyZF7G1AUY+OM0VPZUOeAVpJ4Wl6fydBGUYZxojTDR3I6Bj/+BPkJNA=="
},
"SendGrid": {
"type": "Transitive",
"resolved": "9.25.3",
"contentHash": "Dldhsc4+jV28rfa53W+09A549lDfKqGEFFtdOU4uOxHvS/pFhBN8lRkAEzvbMbycwZJJCzfrDdKc/qT1MxWynQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"starkbank-ecdsa": "[1.3.3, 2.0.0)"
}
},
"Sentry": {
"type": "Transitive",
"resolved": "2.1.5",
@ -1716,6 +1725,11 @@
"System.Threading.Timer": "4.3.0"
}
},
"starkbank-ecdsa": {
"type": "Transitive",
"resolved": "1.3.3",
"contentHash": "OblOaKb1enXn+dSp7tsx9yjwV+/BEKM9jFhshIkZTwCk7LuTFTp+wSon6rFzuPiIiTGtvVWQNUw2slHjGktJog=="
},
"Stripe.net": {
"type": "Transitive",
"resolved": "37.26.0",
@ -3253,6 +3267,7 @@
"Newtonsoft.Json": "12.0.3",
"Otp.NET": "1.2.2",
"Quartz": "3.1.0",
"SendGrid": "9.25.3",
"Sentry.Serilog": "2.1.5",
"Serilog.AspNetCore": "3.4.0",
"Serilog.Extensions.Logging": "3.0.1",
@ -3267,7 +3282,7 @@
"migrator": {
"type": "Project",
"dependencies": {
"Core": "1.46.0",
"Core": "1.46.2",
"Microsoft.Extensions.Logging": "5.0.0",
"dbup-sqlserver": "4.4.0"
}