Add action when mail fails
-
There are a couple functions here that track the last error that the API or SMTP method receive, but they don’t really do anything with that information.
Would love to see an action added so that developers could hook in and do something in case of failure. For example, a Slack notification, so that a developer knows there’s an issue and can look into it. Something like…
function mg_api_last_error($error = null) { static $last_error; if (null === $error) { return $last_error; } else { do_action('mg_error', $error); // A simple idea. $tmp = $last_error; $last_error = $error; return $tmp; } }
Could also consolidate all error handling to a single class rather than the SMTP and API having pretty much identical implementations.
Happy to issue a PR on GitHub, if you’re accepting PRs.
- The topic ‘Add action when mail fails’ is closed to new replies.