diff --git a/src/server/gateway/Email/DelegatingSendGridClient.cs b/src/server/gateway/Email/DelegatingSendGridClient.cs index 87c9a238..d986740a 100644 --- a/src/server/gateway/Email/DelegatingSendGridClient.cs +++ b/src/server/gateway/Email/DelegatingSendGridClient.cs @@ -30,15 +30,17 @@ public string MediaType public DelegatingSendGridClient(HttpClient client, IOptions options) { + var value = options.Value; + // If no API key is available, sending will just be a no-op. - if (options.Value.SendGridKey is { } key) + if (value.SendGridKey is { } key) _client = new( client, - new() + new SendGridClientOptions { ApiKey = key, HttpErrorAsException = true, - }); + }.SetDataResidency(value.SendGridRegion)); } [RegisterServices] diff --git a/src/server/gateway/GatewayOptions.cs b/src/server/gateway/GatewayOptions.cs index 3b8cab1c..eb4c7ad5 100644 --- a/src/server/gateway/GatewayOptions.cs +++ b/src/server/gateway/GatewayOptions.cs @@ -20,6 +20,8 @@ internal sealed class GatewayOptions : IOptions public string? SendGridKey { get; set; } + public string SendGridRegion { get; set; } = "global"; + public string EmailAddress { get; set; } = "arise@localhost"; public Duration AccountVerificationTime { get; set; } = Duration.FromDays(7);