diff --git a/Source/StrongGrid.IntegrationTests/Tests/Mail.cs b/Source/StrongGrid.IntegrationTests/Tests/Mail.cs
index 980d200b..056b9935 100644
--- a/Source/StrongGrid.IntegrationTests/Tests/Mail.cs
+++ b/Source/StrongGrid.IntegrationTests/Tests/Mail.cs
@@ -63,11 +63,6 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
{
Enabled = true
},
- Bcc = new BccSettings
- {
- Enabled = true,
- EmailAddress = "recipient3@mailinator.com"
- },
BypassListManagement = new BypassListManagementSettings
{
Enabled = false
diff --git a/Source/StrongGrid.IntegrationTests/Tests/Settings.cs b/Source/StrongGrid.IntegrationTests/Tests/Settings.cs
index a28e0e43..519f99fc 100644
--- a/Source/StrongGrid.IntegrationTests/Tests/Settings.cs
+++ b/Source/StrongGrid.IntegrationTests/Tests/Settings.cs
@@ -33,6 +33,16 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
await log.WriteLineAsync($" - {mailSetting.Title}: {(mailSetting.Enabled ? "Enabled" : "Not enabled")}").ConfigureAwait(false);
}
+ var bccSettings = await client.Settings.GetBccMailSettingsAsync(null, cancellationToken).ConfigureAwait(false);
+ await log.WriteLineAsync("BCC settings retrieved:").ConfigureAwait(false);
+ await log.WriteLineAsync($" - Enabled: {bccSettings.Enabled}").ConfigureAwait(false);
+ await log.WriteLineAsync($" - Address: {bccSettings.EmailAddress}").ConfigureAwait(false);
+
+ var updatedBccSettings = await client.Settings.UpdateBccMailSettingsAsync(false, null, null, cancellationToken).ConfigureAwait(false);
+ await log.WriteLineAsync("BCC settings updated:").ConfigureAwait(false);
+ await log.WriteLineAsync($" - Enabled: {updatedBccSettings.Enabled}").ConfigureAwait(false);
+ await log.WriteLineAsync($" - Address: {updatedBccSettings.EmailAddress}").ConfigureAwait(false);
+
var clickTrackingSettings = await client.Settings.GetClickTrackingSettingsAsync(null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync("Click tracking settings retrieved:").ConfigureAwait(false);
await log.WriteLineAsync($" - Enabled in text content: {clickTrackingSettings.EnabledInTextContent}").ConfigureAwait(false);
diff --git a/Source/StrongGrid/Models/BccSettings.cs b/Source/StrongGrid/Models/BccSettings.cs
index f878fa14..1a4d1c86 100644
--- a/Source/StrongGrid/Models/BccSettings.cs
+++ b/Source/StrongGrid/Models/BccSettings.cs
@@ -1,4 +1,4 @@
-using Newtonsoft.Json;
+using Newtonsoft.Json;
namespace StrongGrid.Models
{
@@ -13,7 +13,7 @@ public class BccSettings
///
/// true if enabled; otherwise, false.
///
- [JsonProperty("enable", NullValueHandling = NullValueHandling.Ignore)]
+ [JsonProperty("enable")]
public bool Enabled { get; set; }
///
@@ -22,7 +22,7 @@ public class BccSettings
///
/// The email address.
///
- [JsonProperty("email", NullValueHandling = NullValueHandling.Ignore)]
+ [JsonProperty("email")]
public string EmailAddress { get; set; }
}
}
diff --git a/Source/StrongGrid/Models/MailSettings.cs b/Source/StrongGrid/Models/MailSettings.cs
index 75d635ef..fc1b3b6f 100644
--- a/Source/StrongGrid/Models/MailSettings.cs
+++ b/Source/StrongGrid/Models/MailSettings.cs
@@ -1,4 +1,4 @@
-using Newtonsoft.Json;
+using Newtonsoft.Json;
namespace StrongGrid.Models
{
@@ -7,15 +7,6 @@ namespace StrongGrid.Models
///
public class MailSettings
{
- ///
- /// Gets or sets the BCC.
- ///
- ///
- /// The BCC.
- ///
- [JsonProperty("bcc", NullValueHandling = NullValueHandling.Ignore)]
- public BccSettings Bcc { get; set; }
-
///
/// Gets or sets the bypass list management.
///
diff --git a/Source/StrongGrid/Resources/ISettings.cs b/Source/StrongGrid/Resources/ISettings.cs
index 0e603f2f..7996f1de 100644
--- a/Source/StrongGrid/Resources/ISettings.cs
+++ b/Source/StrongGrid/Resources/ISettings.cs
@@ -1,5 +1,6 @@
using StrongGrid.Models;
using StrongGrid.Utilities;
+using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -197,6 +198,7 @@ public interface ISettings
///
/// The .
///
+ [Obsolete("As of august 2020, SendGrid has retired BCC mail settings.")]
Task GetBccMailSettingsAsync(string onBehalfOf = null, CancellationToken cancellationToken = default);
///
@@ -209,6 +211,7 @@ public interface ISettings
///
/// The .
///
+ [Obsolete("As of august 2020, SendGrid has retired BCC mail settings.")]
Task UpdateBccMailSettingsAsync(bool enabled, string email, string onBehalfOf = null, CancellationToken cancellationToken = default);
///
diff --git a/Source/StrongGrid/Resources/Mail.cs b/Source/StrongGrid/Resources/Mail.cs
index 1c77c9ea..c0aa1bab 100644
--- a/Source/StrongGrid/Resources/Mail.cs
+++ b/Source/StrongGrid/Resources/Mail.cs
@@ -188,12 +188,6 @@ public async Task SendAsync(
numberOfRecipients += personalizationsCopy.Sum(p => p.Bcc?.Count(r => r != null) ?? 0);
if (numberOfRecipients >= 1000) throw new ArgumentOutOfRangeException(nameof(numberOfRecipients), numberOfRecipients, "The total number of recipients must be less than 1000");
- // SendGrid throws an unhelpful error when the Bcc email address is an empty string
- if (mailSettings?.Bcc != null && string.IsNullOrWhiteSpace(mailSettings.Bcc.EmailAddress))
- {
- mailSettings.Bcc.EmailAddress = null;
- }
-
var isDynamicTemplate = Template.IsDynamic(templateId);
var personalizationConverter = new MailPersonalizationConverter(isDynamicTemplate);
diff --git a/Source/StrongGrid/Resources/Settings.cs b/Source/StrongGrid/Resources/Settings.cs
index 3fe2a7d5..905ca1e9 100644
--- a/Source/StrongGrid/Resources/Settings.cs
+++ b/Source/StrongGrid/Resources/Settings.cs
@@ -2,6 +2,7 @@
using Pathoschild.Http.Client;
using StrongGrid.Models;
using StrongGrid.Utilities;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@@ -369,6 +370,7 @@ public Task GetAllMailSettingsAsync(int limit = 25, int offset
///
/// The .
///
+ [Obsolete("As of august 2020, SendGrid has retired BCC mail settings.")]
public Task GetBccMailSettingsAsync(string onBehalfOf = null, CancellationToken cancellationToken = default)
{
return _client
@@ -388,6 +390,7 @@ public Task GetBccMailSettingsAsync(string onBehalfOf = nul
///
/// The .
///
+ [Obsolete("As of august 2020, SendGrid has retired BCC mail settings.")]
public Task UpdateBccMailSettingsAsync(bool enabled, string email, string onBehalfOf = null, CancellationToken cancellationToken = default)
{
var bccMailSettings = new EmailAddressSetting