Skip to content

dotpmm/emailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fernet SHA-256 SMTP Gmail

Features

  • Multiple recepients
  • Repeat
  • html support in body
  • Cc Bcc Reply-to everything supported

Endpoints

Endpoint Method Description
/ GET Dashboard with lifetime metrics
/auth POST Authenticate with SMTP credentials, get token
/send POST Send email(s) with optional repeat

Usage

1. Get a Gmail App Password

Important

You must use an App Password, not your regular Gmail password.

  1. Go to your Google Account
  2. Navigate to Security2-Step Verification (enable if not already)
  3. Scroll down to App passwords or visit myaccount.google.com/apppasswords
  4. Select Mail and give it a name, then click Generate
  5. Copy the 16-character password (spaces don't matter)
  6. That's your app password which you need to use.

2. Authenticate

curl -X POST https://your-api.com/auth \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","password":"xxxx xxxx xxxx xxxx"}'

Response:

{"token": "abc123...", "expires_in_hours": 1, "message": "..."}

3. Send Email(s)

# Single recipient
curl -X POST https://your-api.com/send \
  -H "Content-Type: application/json" \
  -H "X-Token: abc123..." \
  -d '{"recipients":"[email protected]","subject":"Hello","body":"Hi there!"}'

# Multiple recipients with HTML
curl -X POST https://your-api.com/send \
  -H "Content-Type: application/json" \
  -H "X-Token: abc123..." \
  -d '{
    "recipients": ["[email protected]", "[email protected]"],
    "subject": "Newsletter",
    "body": "<h1>Hello!</h1><p>Welcome aboard.</p>",
    "is_html": true
  }'

Security

  • Credentials encrypted at rest (Fernet/AES) : Go check the code, i have explained in detail!
  • Tokens expire after 1 hour

About

Minimal, secure token-based email API. Auth once, send many!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published