REST service for CAPTCHA-protected email dispatching.
Use case: You have a website with no backend code like one produced with a static site generator. You need to send an email e.g. when a user submits a form. But you can't have your email credentials in the frontend for obvious reasons.
URL | Method | Request Example | Expected Response |
---|---|---|---|
/health |
GET |
I'm ok. |
|
/captcha |
GET |
||
/mail |
POST |
{ "captchaText": "cyc9ga", "mailText": "Hi :)" } |
Status Code 200 |
Specify receiver, sender, subject and SMTP credentials via environment vars. Have a look at the .env-example
file.
Use the /captcha
endpoint to show a CAPTCHA on your site with: <img src="https://mail-bouncer.example.com/captcha">
.
And call the /mail
endpoint providing the users CAPTCHA input and the mails content to send an email.
That's it.
Rename .env-example
to .env
, insert your SMTP credentials and use cargo run
.
Happy hacking :)