-
Notifications
You must be signed in to change notification settings - Fork 584
feat: Provide users possible status codes that SendGrid can return #1155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
maxkoshevoi
wants to merge
5
commits into
sendgrid:main
Choose a base branch
from
maxkoshevoi:mk/SendGridStatusCode
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b947fdf
SendGridStatusCode
maxkoshevoi 016e0ef
Merge branch 'main' into mk/SendGridStatusCode
shwetha-manvinkurke 8e352f2
Merge branch 'main' into mk/SendGridStatusCode
eshanholtz 9e1f47f
Merge branch 'main' into mk/SendGridStatusCode
bfc7f66
Merge branch 'main' into mk/SendGridStatusCode
maxkoshevoi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/SendGrid/Helpers/Errors/Model/SendGridStatusCode.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
namespace SendGrid.Helpers.Errors.Model | ||
{ | ||
/// <summary> | ||
/// Each SMTP call you make returns a response. | ||
/// 200 responses are usually success responses, and 400 responses are usually deferrals. | ||
/// SendGrid continues to retry resending 400 messages for up to 72 hours. | ||
/// 500 responses are hard failures that are not retried by our servers. | ||
/// </summary> | ||
/// <remarks> | ||
/// <see href="https://docs.sendgrid.com/for-developers/sending-email/smtp-errors-and-troubleshooting"/>. | ||
/// </remarks> | ||
public enum SendGridStatusCode | ||
{ | ||
/// <summary> | ||
/// Your mail has been successfully queued! | ||
/// This response indicates that the recipient server has accepted the message. | ||
/// </summary> | ||
QueuedForDelivery = 250, | ||
|
||
/// <summary> | ||
/// This means the "from" address does not match a verified Sender Identity. | ||
/// Mail cannot be sent until this error is resolved. | ||
/// </summary> | ||
/// <remarks> | ||
/// To learn how to resolve this error, see our <see href="https://docs.sendgrid.com/for-developers/sending-email/sender-identity">Sender Identity requirements</see>. | ||
/// </remarks> | ||
InvalidFromAddress = 403, | ||
|
||
/// <summary> | ||
/// Messages are temporarily deferred because of recipient server policy - often it's because of too many messages or connections in too short of a timeframe. | ||
/// </summary> | ||
/// <remarks> | ||
/// We continue to retry deferred messages for up to 72 hours. | ||
/// Consider temporarily sending less messages to a domain that is returning this code because this could further delay your messages currently being tried. | ||
/// </remarks> | ||
MessagesDeferred = 421, | ||
|
||
/// <summary> | ||
/// The message failed because the recipient's mailbox was unavailable, perhaps because it was locked or was not routable at the time. | ||
/// </summary> | ||
/// <remarks> | ||
/// We continue to retry messages for up to 72 hours. | ||
/// Consider temporarily sending less messages to a domain that is returning this code because this could further delay your messages currently being tried. | ||
/// </remarks> | ||
MailboxUnavailable = 450, | ||
|
||
/// <summary> | ||
/// There is a credit limit of emails per day enforced in error. | ||
/// </summary> | ||
/// <remarks> | ||
/// <see href="https://support.sendgrid.com/hc">Contact support</see> to remove that limit. | ||
/// </remarks> | ||
MaximumCreditsExceeded = 451, | ||
|
||
/// <summary> | ||
/// The message has been deferred due to insufficient system storage. | ||
/// </summary> | ||
/// <remarks> | ||
/// We continue to retry messages for up to 72 hours. | ||
/// </remarks> | ||
TooManyRecipientsThisHour = 452, | ||
|
||
/// <summary> | ||
/// The user’s mailbox was unavailable. | ||
/// Usually because it could not be found, or because of incoming policy reasons. | ||
/// </summary> | ||
/// <remarks> | ||
/// Remove these address from your list - it is likely a fake, or it was mistyped. | ||
/// </remarks> | ||
InvalidMailbox = 550, | ||
|
||
/// <summary> | ||
/// The intended mailbox does not exist on this recipient server. | ||
/// </summary> | ||
/// <remarks> | ||
/// Remove these addresses from your list. | ||
/// </remarks> | ||
UserDoesNotExist = 551, | ||
|
||
/// <summary> | ||
/// The recipients mailbox has exceeded its storage limits. | ||
/// </summary> | ||
/// <remarks> | ||
/// We don't resend messages with this error code because this is usually a sign this is an abandoned email. | ||
/// </remarks> | ||
MailboxIsFull = 552, | ||
|
||
/// <summary> | ||
/// The message was refused because the mailbox name is either malformed or does not exist. | ||
/// </summary> | ||
/// <remarks> | ||
/// Remove these addresses from your list. | ||
/// </remarks> | ||
InvalidUser = 553, | ||
|
||
/// <summary> | ||
/// This is a default response that can be caused by a lot of issues. | ||
/// </summary> | ||
/// <remarks> | ||
/// There is often a human readable portion of this error that gives more detailed information, but if not, | ||
/// remove these addresses from your list. | ||
/// </remarks> | ||
MailRefused = 554, | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to this property when the value is not defined in
SendGridStatusCode
? Guessingnull
and worried that clients would then not get the actual status code. Could this be added as an extra property ofSendGridErrorResponse
so it's backwards-compatible and supports the benefits of the enum?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum
s are value type, so cannot benull
. If value ofErrorHttpStatusCode
is not defined inSendGridStatusCode
, it will still be stored inErrorHttpStatusCode
(Visual Studio will just show you int value instead of a name).Admittedly, this might be not the best solution since value of
ErrorHttpStatusCode
might be outside of what's definedSendGridStatusCode
, but no information will be lost.