Skip to content

Go-based REST API service for sending emails through Gmail's SMTP server

Notifications You must be signed in to change notification settings

ry444nn/go-mailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

Go-based REST API service for sending emails through Gmail's SMTP server. It provides a simple HTTP endpoint to queue and send emails to one or multiple recipients.

Architecture

API Endpoints

POST /email

Sends an email asynchronously.

Request Body:

{
  "to": "[email protected]",
  "from": "[email protected]",
  "subject": "Email Subject",
  "body": "<h1>HTML Email Body</h1>"
}

Response:

{
  "message": "OK",
  "status": "continue"
}

Notes:

  • Multiple recipients are supported by comma-separating email addresses in the to field
  • Emails are sent asynchronously using goroutines
  • The endpoint returns immediately regardless of send status

GET /ping

Health check endpoint that returns a simple "ok" status.

Configuration

Environment Variables

  • HTTP_PORT - HTTP server port (default: 8080)

SMTP Configuration

Configured in configure.go:

  • Server: smtp.gmail.com
  • Port: 587
  • Credentials: Email and password (currently hardcoded as "email" and "secret")

Deployment

The project includes a Dockerfile for containerized deployment using Go 1.18. Yet, as this project is from many years ago you might find some compatibility issues be adviced.

About

Go-based REST API service for sending emails through Gmail's SMTP server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published