http2smtp

command module
v0.2.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

README

HTTP2SMTP - USE HTTP SEND EMAIL

GitHub Downloads Docker Pulls License Wechat Group GitHub last commit GitHub Actions Workflow Status GitHub top language

English🌎 | 简体中文🀄

Important Updates

Added scheduled task functionality, which allows using cron expressions to periodically read results from an API or link and send emails. Supports configuring templates for JSON response APIs to convert JSON data into text for email content.

Project Description

A gateway service that converts SMTP protocol to HTTP interfaces, helping developers:

  • Avoid hardcoding SMTP configurations in code
  • Dynamically send emails through REST API
  • Visually configure multiple SMTP providers
  • Use scheduled tasks to reduce email configuration in projects

Main Features

  • 🚀 Configure SMTP servers and recipient emails via Web UI
  • 📦 Support for GET/POST/JSON request formats
  • 🔒 Token-based API access control
  • 📎 Multi-file attachment support (Base64 encoding/form upload)
  • 🐳 Ready-to-use Docker image
  • 📊 Send record query and statistics
  • 📅 Scheduled task support for requesting links and sending emails
  • 📧 Email template support

Community

Welcome to join WeChat group or Telegram for more suggestions.

WeChat group:

WebChat

Telegram:

https://t.me/+JClG9_DojaM0ZGE1

Quick Start

Direct Execution
# Windows (PowerShell environment)
# Download package
Invoke-WebRequest -Uri "https://github.com/chuccp/http2smtp/releases/latest/download/http2smtp-windows-amd64.tar.gz" -OutFile "http2smtp-windows-amd64.tar.gz"
# Extract files
tar -zxvf http2smtp-windows-amd64.tar.gz
# Run program
.\http2smtp.exe

# Linux
# Download package (using wget for compatibility)
wget https://github.com/chuccp/http2smtp/releases/latest/download/http2smtp-linux-amd64.tar.gz
# Extract files
tar -zxvf http2smtp-linux-amd64.tar.gz
# Add execution permissions and run
chmod +x http2smtp
./http2smtp
Docker Execution
##use docker-compose(recommended)
cd docker
docker compose up -d

or

docker pull cooge123/http2smtp

docker run -p 12566:12566 -p 12567:12567 -it --rm cooge123/http2smtp

After startup, access the management page using the default port number: http://127.0.0.1:12566

Configuration Instructions

After first startup, the configuration file config.ini is generated:

[core]
init      = true   ## Initialization switch, becomes true after initial configuration
cachePath = .cache  ## Email attachment cache directory
dbType    = sqlite  ## Database type, supports sqlite and mysql

[sqlite]
filename = d-mail.db  ## Database path

[manage]
port     = 12566      ## Management port
username = 111111     ## Management username
password = 111111     ## Management password
webPath  = web        ## Management page path

[api]
port = 12567          ## API port

[mysql]
host     = 127.0.0.1   ## Database address
port     = 3306         ## Database port
dbname   = d_mail      ## Database name
charset  = utf8        ## Database character set
username = root        ## Database username
password = 123456      ## Database password

API Documentation

Send Email API

POST /sendMail

Parameters:

Parameter Type Required Description
token string Yes Authorization token
subject string No Email subject
content string Yes Email content
recipients []string No Additional recipient list
files []File No Attachment file list

Successful Response:

ok
Complete Request Examples

JSON Format (with attachments)

curl -X POST 'http://127.0.0.1:12567/sendMail' \
--header 'Content-Type: application/json' \
--data-raw '{
  "token": "{{token}}",
  "subject": "test",
  "content": "this is a test",
  "recipients": ["ops@example.com"],
  "files": [
    {
      "name": "alert.log",
      "data": "{{base64_content}}"
    }
  ]
}'

Form Submission (with multiple attachments)

curl -X POST 'http://127.0.0.1:12567/sendMail' \
--form 'token={{token}}' \
--form 'subject=test' \
--form 'content=this is a test' \
--form 'recipients=finance@example.com,sales@example.com' \
--form 'files=@"/data/reports/sales.pdf"' \
--form 'files=@"/data/reports/expenses.xlsx"'

GET Request Example

curl 'http://127.0.0.1:12567/sendMail?token={{token}}&subject=test&content=this%20is%20a%20test&recipients=aaa@mail.com,bbb@mail.com'

Build Instructions

Compilation requires first building the frontend interface d-mail-view

UI Display

initialize
WebChat
add SMTP
WebChat
add email address
WebChat
add TOEKN
WebChat
add schedule
WebChat

License

License

This project is licensed under the Apache License 2.0.

See the LICENSE file for the full license text.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL