Turn JSON requests into HTML pages and send email links to them
834
A Docker service that creates HTML pages from POST requests and sends email links to the generated pages.
| Variable | Description | Default |
|---|---|---|
| PORT | Server port | 3000 |
| SMTP_HOST | SMTP server host | (required for email) |
| SMTP_PORT | SMTP server port | 25 |
| SMTP_USER | SMTP username | (optional) |
| SMTP_PASS | SMTP password | (optional) |
| DOMAIN_NAME | Domain name for generated links | localhost:3000 |
| EMAIL_FROM | Sender email address | (required for email) |
| EMAIL_TO | Recipient email address | (required for email) |
Creates a new HTML page.
Request Body:
{
"title": "Page Title",
"message": "Page content goes here.\nThis will be converted to HTML."
}
If the message contains <html> tags, the entire message will be used as the HTML content.
Response:
Serves an HTML page by its ID (timestamp).
For example, /2025-01-02-143376 will serve the file /etc/email-page/data/page-2025-01-02-143376.html.
Response:
Build the Docker image:
docker build -t emailpage .
Run the container:
docker run -p 3000:3000 \
-e SMTP_HOST=smtp.example.com \
-e SMTP_PORT=587 \
-e [email protected] \
-e SMTP_PASS=password \
-e DOMAIN_NAME=example.com \
-e [email protected] \
-e [email protected] \
-v /path/to/local/data:/etc/email-page/data \
emailpage
Or use with docker-compose:
Create a docker-compose.yml file with the following content:
services:
email-page:
image: jordanroher/email-page
container_name: email-page
ports:
- 3000:3000
environment:
- SMTP_HOST=smtp.example.com
- SMTP_PORT=587
- SMTP_USER=username
- SMTP_PASS=password
- DOMAIN_NAME=email-page.example.com
- [email protected]
- [email protected]
volumes:
- data:/etc/email-page/data
volumes:
data:
Then run:
# Create a local data directory if it doesn't exist
mkdir -p data
# Start the service
docker-compose up -d
You can test the API with curl:
curl -X POST http://localhost:3000/new \
-H "Content-Type: application/json" \
-d '{"title":"Test Page","message":"Hello, world!\nThis is a test page."}'
Content type
Image
Digest
sha256:eeb15f409…
Size
190.5 MB
Last updated
over 1 year ago
docker pull jordanroher/email-page