-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: refactor email sending functions (#1495)
## What kind of change does this PR introduce? The overall goal of this to expose a unified interface for emails. So that we can potentially implement the Hook as a Custom Mailer. This is to ensure that the impact on the existing code flow is minimal and that we can turn off the Hook easily if needed. After this change, we can do something similar to: ``` mailer. := a.Mailer() if a.config.Hook.Enabled { mailer = a.CustomMailer } ``` and have all Hook logic live in the custom Mailer Specific changes are: - Removes context from mailer as it is currently unused - pushes down mailer into respective email sending methods - Adds remaining send methods as API methods - Fetch OTP Length and MaxFrequency from config - Add convenience function for checking if an email was sent within frequency limit - push down `externalURL` and `referrer` into send function --------- Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
- Loading branch information
1 parent
96f7a68
commit 285c290
Showing
13 changed files
with
95 additions
and
83 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
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
Oops, something went wrong.