feat: arbitrary emails on server side and dynamic message configs#112
Open
dword-design wants to merge 9 commits intomasterfrom
Open
feat: arbitrary emails on server side and dynamic message configs#112dword-design wants to merge 9 commits intomasterfrom
dword-design wants to merge 9 commits intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #112 +/- ##
===========================================
- Coverage 86.11% 71.42% -14.69%
===========================================
Files 2 4 +2
Lines 36 56 +20
===========================================
+ Hits 31 40 +9
- Misses 5 16 +11
Continue to review full report at Codecov.
|
This was
linked to
issues
Feb 14, 2022
This was
linked to
issues
Feb 15, 2022
Closed
This was referenced Feb 15, 2022
Closed
|
Hi! Any updates on this? Any way we could help? |
|
@dword-design How could we help in order to have it ASAP? BTW, thanks for the great module! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I think I have come up with a solution that might fit for most users. The idea is similar to the one I sketched out above. What you basically do when sending emails from the client is to define message configs and then calling those configs with parameters. It's similar to the template system in EmailJS. This way you can define your emails in a flexible way without risking security leaks. The definition as a plain object is still the safest way to do it because
nuxt-mailwill filter out the risky fields. When setting a message config to a function, the developer is responsible to only pass the right fields through.Here is an example of how message configs look like:
Then send the email like so:
On the server side, you have full freedom now.
this.$mail.sendbehaves different depending on if it is on the client or the server, so for more complex logic, you can run$mail.sendfrom the application context.I've implemented the proposal in this pull request. Before deploying it I'd like to get your opinion on it since it has some breaking changes and there are many use cases to cover. You can find the more detailed explanation in the updated readme in the PR. To test the PR, check out the branch locally and run
yarn --frozen-lockfile && yarn prepublishOnly. Then add it to some project viayarn add ../nuxt-mail.Alright thanks for waiting, looking forward to your feedback!