Lightweight Docker image based on nginx:alpine that serves static websites and handles contact form submissions via SMTP.
nginx:1.29-alpine (~35MB total)linux/amd64 and linux/arm64docker run -d \
-p 80:80 \
-v /path/to/site:/usr/share/nginx/html:ro \
-e SMTP_HOST=smtp.example.com \
-e SMTP_PORT=465 \
-e [email protected] \
-e SMTP_PASSWORD=your-password \
-e [email protected] \
-e [email protected] \
drumsergio/nginx-mailer:latest
services:
website:
image: drumsergio/nginx-mailer:latest
ports:
- "80:80"
volumes:
- ./website:/usr/share/nginx/html:ro
environment:
- SMTP_HOST=smtp.example.com
- SMTP_PORT=465
- [email protected]
- SMTP_PASSWORD=your-password
- [email protected]
- SMTP_FROM_NAME=My Website
- [email protected]
- CLOUDFLARE_TURNSTILE_SECRET_KEY= # Optional
restart: unless-stopped
| Variable | Required | Description |
|---|---|---|
SMTP_HOST | Yes | SMTP server hostname |
SMTP_PORT | Yes | SMTP port (465 for SSL, 587 for STARTTLS) |
SMTP_USER | Yes | SMTP username |
SMTP_PASSWORD | Yes | SMTP password |
SMTP_FROM | Yes | From email address |
SMTP_FROM_NAME | No | From display name |
CONTACT_EMAIL | Yes | Recipient email for contact forms |
CLOUDFLARE_TURNSTILE_SECRET_KEY | No | Turnstile secret key |
{
"nombre": "John Doe",
"email": "[email protected]",
"telefono": "+1234567890",
"ubicacion": "City",
"mensaje": "Hello...",
"cf-turnstile-response": "token"
}
Returns 200 OK for health checks.
<form action="/api/contact" method="POST">
<input type="text" name="nombre" placeholder="Name" required>
<input type="email" name="email" placeholder="Email" required>
<input type="tel" name="telefono" placeholder="Phone">
<textarea name="mensaje" placeholder="Message" required></textarea>
<!-- Optional: Cloudflare Turnstile -->
<div class="cf-turnstile" data-sitekey="your-site-key"></div>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<button type="submit">Send</button>
</form>
MIT
Content type
Image
Digest
sha256:85c8dc510…
Size
44.5 MB
Last updated
7 months ago
docker pull drumsergio/nginx-mailer