Skip to content

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

open-mail-sender

open-mail-sender is a minimal API service to send emails using Nodemailer and external SMTP servers. Built with Node.js, MongoDB, and Docker — easy to self-host and extend.


✉️ features

  • single POST /send-mail API
  • send plain or HTML emails
  • optional wait vs background delivery
  • API key–based auth
  • MongoDB mail logging
  • docker-ready

🚀 usage

  1. clone the repo

    git clone https://github.com/Abhay-Vachhani/open-mail-sender
    cd open-mail-sender
  2. create .env

    cp .env.example .env

    fill in your SMTP and MongoDB credentials

  3. run in development

    docker compose -f docker-compose.dev.yml up --build
  4. run in production

    docker compose up --build -d

📦 api

POST /send-mail

headers

x-api-key: your-api-key  
content-type: application/json

body

{
  "to": "test@example.com",
  "subject": "hello",
  "text": "plain text",
  "html": "<b>optional html</b>",
  "wait": true
}

response (wait = true)

{
  "message": "email sent",
  "messageId": "abc123"
}

response (wait = false)

{
  "message": "email send queued",
  "logId": "..."
}

🔐 security

  • uses x-api-key header for client auth
  • set API_KEY in .env
  • SMTP credentials are never exposed to the client

🛠 dev tools

# generate a new api key
yarn generate-key

📂 file structure

.
├── index.js              → express app + routes
├── models/               → mongoose models
├── generate-api-key.js   → simple CLI tool
├── .env / .env.example   → environment config
├── docker-compose.yml    → mongo + app container
└── readme.md

📄 license

MIT

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages