Skip to content

Commit 5ed9472

Browse files
asos-vinodpatilshwetha-manvinkurkeJenniferMahrakatyal
authored
feat: Added mail settings attributes for bypass_spam_management, bypass_bou… (#1153)
* Added mail settings attributes for bypass_spam_management, bypass_bounce_management and bypass_unsubscribe_management #1135 * Documentation for bypass_spam_management, bypass_bounce_management and bypass_unsubscribe_management * Review comments- Udated right summary from the api spec Co-authored-by: Shwetha Radhakrishna <[email protected]> Co-authored-by: Jennifer Mah <[email protected]> Co-authored-by: Raghav Katyal <[email protected]>
1 parent 75aea3a commit 5ed9472

File tree

8 files changed

+235
-2
lines changed

8 files changed

+235
-2
lines changed

USAGE.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -2444,6 +2444,9 @@ This endpoint allows you to send email over Twilio SendGrid's v3 Web API, the mo
24442444
* Top level parameters are referred to as "global".
24452445
* Individual fields within the personalizations array will override any other global, or message level, parameters that are defined outside of personalizations.
24462446

2447+
* Note: bypass_bounce_management, bypass_spam_management, and bypass_unsubscribe_management cannot
2448+
* be combined with bypass_list_management
2449+
24472450
For an overview of the v3 Mail Send endpoint, please visit our [v3 API Reference](https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html)
24482451

24492452
For more detailed information about how to use the v3 Mail Send endpoint, please visit our [Classroom](https://sendgrid.com/docs/Classroom/Send/v3_Mail_Send/index.html).
@@ -2501,7 +2504,16 @@ string data = @"{
25012504
},
25022505
'bypass_list_management': {
25032506
'enable': true
2504-
},
2507+
},
2508+
'bypass_spam_management': {
2509+
'enable': true
2510+
},
2511+
'bypass_bounce_management': {
2512+
'enable': true
2513+
},
2514+
'bypass_unsubscribe_management': {
2515+
'enable': true
2516+
},
25052517
'footer': {
25062518
'enable': true,
25072519
'html': '<p>Thanks</br>The Twilio SendGrid Team</p>',

USE_CASES.md

+8
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,14 @@ namespace Example
319319
320320
msg.SetBccSetting(true, "[email protected]");
321321

322+
// Note: Bypass Spam, Bounce, and Unsubscribe management cannot be combined with Bypass List Management
323+
msg.BypassSpamManagement(true);
324+
325+
msg.BypassBounceManagement(true);
326+
327+
msg.BypassUnsubscribeManagement(true);
328+
329+
// OR
322330
msg.SetBypassListManagement(true);
323331

324332
msg.SetFooterSetting(true, "Some Footer HTML", "Some Footer Text");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// <copyright file="BypassListManagement.cs" company="Twilio SendGrid">
2+
// Copyright (c) Twilio SendGrid. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
// </copyright>
5+
6+
using Newtonsoft.Json;
7+
8+
namespace SendGrid.Helpers.Mail
9+
{
10+
/// <summary>
11+
/// Allows you to bypass the bounce list to ensure that the email is delivered to recipients. Spam report and unsubscribe lists will still be checked; addresses on these other lists will not receive the message.
12+
/// </summary>
13+
[JsonObject(IsReference = false)]
14+
public class BypassBounceManagement
15+
{
16+
/// <summary>
17+
/// Gets or sets a value indicating whether this setting is enabled.
18+
/// </summary>
19+
[JsonProperty(PropertyName = "enable")]
20+
public bool Enable { get; set; }
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// <copyright file="BypassListManagement.cs" company="Twilio SendGrid">
2+
// Copyright (c) Twilio SendGrid. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
// </copyright>
5+
6+
using Newtonsoft.Json;
7+
8+
namespace SendGrid.Helpers.Mail
9+
{
10+
/// <summary>
11+
/// Allows you to bypass the spam report list to ensure that the email is delivered to recipients. Bounce and unsubscribe lists will still be checked; addresses on these other lists will not receive the message.
12+
/// </summary>
13+
[JsonObject(IsReference = false)]
14+
public class BypassSpamManagement
15+
{
16+
/// <summary>
17+
/// Gets or sets a value indicating whether this setting is enabled.
18+
/// </summary>
19+
[JsonProperty(PropertyName = "enable")]
20+
public bool Enable { get; set; }
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// <copyright file="BypassListManagement.cs" company="Twilio SendGrid">
2+
// Copyright (c) Twilio SendGrid. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
// </copyright>
5+
6+
using Newtonsoft.Json;
7+
8+
namespace SendGrid.Helpers.Mail
9+
{
10+
/// <summary>
11+
/// Allows you to bypass the global unsubscribe list to ensure that the email is delivered to recipients. Bounce and spam report lists will still be checked; addresses on these other lists will not receive the message. This filter applies only to global unsubscribes and will not bypass group unsubscribes.
12+
/// </summary>
13+
[JsonObject(IsReference = false)]
14+
public class BypassUnsubscribeManagement
15+
{
16+
/// <summary>
17+
/// Gets or sets a value indicating whether this setting is enabled.
18+
/// </summary>
19+
[JsonProperty(PropertyName = "enable")]
20+
public bool Enable { get; set; }
21+
}
22+
}

src/SendGrid/Helpers/Mail/Model/MailSettings.cs

+18
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ public class MailSettings
2525
[JsonProperty(PropertyName = "bypass_list_management")]
2626
public BypassListManagement BypassListManagement { get; set; }
2727

28+
/// <summary>
29+
/// Gets or sets the bypass of spam report list to ensure that the email is delivered to recipients. Bounce and unsubscribe lists will still be checked; addresses on these other lists will not receive the message.
30+
/// </summary>
31+
[JsonProperty(PropertyName = "bypass_spam_management")]
32+
public BypassSpamManagement BypassSpamManagement { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets the bypass the bounce list to ensure that the email is delivered to recipients. Spam report and unsubscribe lists will still be checked; addresses on these other lists will not receive the message.
36+
/// </summary>
37+
[JsonProperty(PropertyName = "bypass_bounce_management")]
38+
public BypassBounceManagement BypassBounceManagement { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the bypass the global unsubscribe list to ensure that the email is delivered to recipients. Bounce and spam report lists will still be checked; addresses on these other lists will not receive the message. This filter applies only to global unsubscribes and will not bypass group unsubscribes.
42+
/// </summary>
43+
[JsonProperty(PropertyName = "bypass_unsubscribe_management")]
44+
public BypassUnsubscribeManagement BypassUnsubscribeManagement { get; set; }
45+
2846
/// <summary>
2947
/// Gets or sets the default footer that you would like appended to the bottom of every email.
3048
/// </summary>

src/SendGrid/Helpers/Mail/SendGridMessage.cs

+57
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,63 @@ public void SetBypassListManagement(bool enable)
860860
return;
861861
}
862862

863+
/// <summary>
864+
/// Set the bypass spam management setting.
865+
/// Allows you to bypass the spam report list to ensure that the email is delivered to recipients. Bounce and unsubscribe lists will still be checked; addresses on these other lists will not receive the message.
866+
/// </summary>
867+
/// <param name="enable">Gets or sets a value indicating whether this setting is enabled.</param>
868+
public void SetBypassSpamManagement(bool enable)
869+
{
870+
if (this.MailSettings == null)
871+
{
872+
this.MailSettings = new MailSettings();
873+
}
874+
875+
this.MailSettings.BypassSpamManagement = new BypassSpamManagement
876+
{
877+
Enable = enable,
878+
};
879+
return;
880+
}
881+
882+
/// <summary>
883+
/// Set the bypass bounce management setting.
884+
/// Allows you to bypass the bounce list to ensure that the email is delivered to recipients. Spam report and unsubscribe lists will still be checked; addresses on these other lists will not receive the message.
885+
/// </summary>
886+
/// <param name="enable">Gets or sets a value indicating whether this setting is enabled.</param>
887+
public void SetBypassBounceManagement(bool enable)
888+
{
889+
if (this.MailSettings == null)
890+
{
891+
this.MailSettings = new MailSettings();
892+
}
893+
894+
this.MailSettings.BypassBounceManagement = new BypassBounceManagement
895+
{
896+
Enable = enable,
897+
};
898+
return;
899+
}
900+
901+
/// <summary>
902+
/// Set the bypass unsubscribe management setting.
903+
/// Allows you to bypass the global unsubscribe list to ensure that the email is delivered to recipients. Bounce and spam report lists will still be checked; addresses on these other lists will not receive the message. This filter applies only to global unsubscribes and will not bypass group unsubscribes.
904+
/// </summary>
905+
/// <param name="enable">Gets or sets a value indicating whether this setting is enabled.</param>
906+
public void SetBypassUnsubscribeManagement(bool enable)
907+
{
908+
if (this.MailSettings == null)
909+
{
910+
this.MailSettings = new MailSettings();
911+
}
912+
913+
this.MailSettings.BypassUnsubscribeManagement = new BypassUnsubscribeManagement
914+
{
915+
Enable = enable,
916+
};
917+
return;
918+
}
919+
863920
/// <summary>
864921
/// Set the footer setting.
865922
/// The default footer that you would like appended to the bottom of every email.

0 commit comments

Comments
 (0)