Free email server, available everywhere, without all the pains on domains and certificates.
236
__ ___ _ __ ____
/ |/ /__ _(_) / / __/__ _____ _____ ____
/ /|_/ / _ `/ / / _\ \/ -_) __/ |/ / -_) __/
/_/ /_/\_,_/_/_/ /___/\__/_/ |___/\__/_/
Completely FREE and Open Source like Mail In A Box, Docker Mailserver, Mailu and Maddy Mail Server, but DOESN'T REQUIRE posessing a domain, DOESN'T REQUIRE loads of docker compose configurations and DOESN'T REQUIRE a HTTPS certificate.
Notice: DO NOT use this project in large-scale production environments.
read -p "Password: " -s password && \
docker run --rm -it -p <LOCAL_PORT>:8080 \
-e "NAME=<DISPLAY_SENDER_NAME>" \
-e "EMAIL=<[email protected]>" \
-e "PASSWORD=${password}" \
johndope/mail-server:latest
There will be a prompt for "Password", paste your Email password and hit enter (whatever you paste or input will not be shown on the screen).
Email addresses from these 4 SMTP mail service providers can be automatically configured: Gmail, Yandex, QQ (Tencent) and 163 (NetEase).
NOTICE:
Mail Server also supports custom provider configurations, just add the SMTP_DOMAIN (eg. smtp.gmail.com) and SMTP_SSL_PORT (eg. 465) env variables.
Here's a simple example for Python users:
import requests
resp = requests.get(SERVER_INSTANCE, params={
'subject': 'Please validate your email address',
'receiver': [RECEIVER_EMAIL, ANOTHER_RECEIVER_EMAIL],
'html': f'<h1>Hello from {BRAND_NAME}!</h1>',
})
resp.raise_for_status()
print(resp.json())
Mail Server also supports templates. Mail Server ships with a default template (for new registered account activation), to use this template:
activation_template_args = {
'username': 'John Theo',
'activation_link': 'https://github.com/john-theo',
'brand_name': BRAND_NAME,
'contact_email': RECEIVER_EMAIL,
}
resp = requests.post(SERVER_INSTANCE, data={
'subject': 'Please validate your email address',
'receiver': [RECEIVER_EMAIL],
'template': 'activation',
**activation_template_args
}, files=[
('attachments', ('activation.jinja', open('templates/activation.jinja', 'rb'))),
('attachments', ('server.py', open('src/server.py', 'rb')))
])
resp.raise_for_status()
print(resp.json())
You can also mount your own templates into the docker container and use them.
To debug your own templates, you can use the /debug (backward compatibility) or the /preview endpoint with the same request payload, it will response the renderer HTML page with parsed parameters at the bottom.
TOTP, or time-based one-time password, is the algorithm commonly used by authenticators for 2FA, it generates a one-time password that uses the current time as a source of uniqueness.
If you deploy Mail Server to a publicly accessible domain (like Heroku), anyone can send emails on your behalf which is highly dangerous. So to enable TOTP to reject requests not send by your trusted backends:
TOTP_SECRET env variable;totp (eg. GET /?totp=072813).There are packages in various languages that can generate the TOTP token like ROTP for Ruby, PyTOP for Python, OTPlib for Nodejs and many more.
To generate a secret key run:
docker run --rm -it \
johndope/mail-server:latest \
bash generate_totp.sh
.env filemake hinit && make hpushMail Server by John Dope is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
Content type
Image
Digest
Size
22.8 MB
Last updated
over 4 years ago
docker pull johndope/mail-server