[feat] Sample Documentation update for encrypt API
Describe the feature
In the https://forwardemail.net/en/email-api#encrypt sample, it suggests
curl -X POST https://api.forwardemail.net/v1/encrypt \
-d "[email protected]"
But when using regex matching for $1, it tries to use a shell variable expansion instead of as a literal $1. I would suggest using 'single quotes' instead - otherwise after a few minutes it bounces with an 'invalid "forward-email" TXT record due to an invalid regular expression email address match>'.
curl -X POST https://api.forwardemail.net/v1/encrypt -d 'input=/^(alias1|alias2)$/:[email protected]'
Checklist
- [x] I have searched through GitHub issues for similar issues.
- [x] I have completely read through the README and documentation.
Trying to emulate a DL is still failing if I use a 2nd +$1 it bounces, maybe I'm doing it wrong?
curl -X POST https://api.forwardemail.net/v1/encrypt -d 'input=/^(alias1|alias2)$/:[email protected],/^(alias1|alias2)$/:[email protected]'
Thanks @ianssoftcom on the docs update for double vs single quotes. Agree the shell expansion here is dangerous. For the 2nd address, I think you would need to encrypt each separately and then combine.
Encrypt user 1
curl -X POST https://api.forwardemail.net/v1/encrypt -d 'input=/^(alias1|alias2)$/:[email protected]'
Encrypt user 2
curl -X POST https://api.forwardemail.net/v1/encrypt -d 'input=/^(alias1|alias2)$/:[email protected]'
Combine the encrypted rules (will need to write a test for this)
"v=forward-email&<encrypted-output-A>,<encrypted-output-B>"