Assuming you have access to a web server with support for Docker, you can use this command to run the service:
docker run -d \
--name=post-to-email \
-p 8080:80 \
-e ALLOW_ORIGIN="*" \
-e DSN="smtp://user:password@smtp.my-domain.com:port" \
-e RECIPIENT="Matthias Mullie <my-email@example.com>" \
matthiasmullie/post-to-email
This will pull the matthiasmullie/post-to-email
image from Docker Hub and run it exposed on port 8080 with a hard-coded DSN
and RECIPIENT
.
- For
ALLOW_ORIGIN
, enter the domain you want to accept requests from (e.g.https://my-website.com
), or*
to allow requests from anywhere- To prevent abuse, I'd recommend locking things down to a specific domain unless there's a good reason not to
- Read up on Access-Control-Allow-Origin if you want to learn more
DSN
should be your SMTP connection stringRECIPIENT
is the email address you want to receive emails at- This can take either
my-email@example.com
orMy Name <my-email@example.com>
format
- This can take either
While it's possible to include these variables in the data your form will submit, it makes sense to hard-code some of these in the web service, to prevent others from being able to (ab)use your service.
Note: don't forget to replace below DSN & RECIPIENT variables with your own. Check configuration to see what other environment variables are available.