Currently, the retry mechanism for sending emails does not differentiate between different types of errors. A better approach would be to classify errors and decide whether a retry should occur based on the error type.
### Is your feature request related to a problem? Please describe. Currently, the retry mechanism for sending emails does not differentiate between different types of errors. In some cases, retries may occur even when the failure is caused by a client-side issue, where retrying would not resolve the problem. A better approach would be to classify errors and decide whether a retry should occur based on the error type. For example: Client errors (4xx) such as 400, 403, etc., usually indicate an issue with the request (invalid parameters, permission issues, etc.). Retrying in these cases is unlikely to succeed, so retries should stop immediately. Server errors (5xx) such as 500, 501, etc., typically indicate temporary service failures. In such cases, retry attempts could help if the service recovers. ### Describe the solution (or solutions) you'd like Update the retry email mechanism to check the error code before retrying: Do not retry for 4xx errors. Allow retries for 5xx error