-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add email validation function to lower bounce rates (#1845)
The goal is to only return an error when we have a very high confidence the email won't be deliverable. This is currently going to be added as a draft for the team to review. I haven't actually implemented any paths that call this or configuration around when it is activated. --------- Co-authored-by: Chris Stockton <[email protected]>
- Loading branch information
Showing
10 changed files
with
727 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,14 +1,28 @@ | ||
package mailer | ||
|
||
import ( | ||
"context" | ||
"errors" | ||
) | ||
|
||
type noopMailClient struct{} | ||
type noopMailClient struct { | ||
EmailValidator *EmailValidator | ||
} | ||
|
||
func (m *noopMailClient) Mail(to, subjectTemplate, templateURL, defaultTemplate string, templateData map[string]interface{}, headers map[string][]string, typ string) error { | ||
func (m *noopMailClient) Mail( | ||
ctx context.Context, | ||
to, subjectTemplate, templateURL, defaultTemplate string, | ||
templateData map[string]interface{}, | ||
headers map[string][]string, | ||
typ string, | ||
) error { | ||
if to == "" { | ||
return errors.New("to field cannot be empty") | ||
} | ||
if m.EmailValidator != nil { | ||
if err := m.EmailValidator.Validate(ctx, to); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} |
This file contains 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
Oops, something went wrong.