Skip to content

A bare-minimum TCP-level SMTP server implementation in Go for a server to send and receive emails.

Notifications You must be signed in to change notification settings

abbychau/gtsmail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go SMTP Server

A bare-minimum TCP-level SMTP server implementation in Go for a server to send and receive emails.

Features

  • SMTP server listening on port 25
  • Handles basic SMTP commands (HELO/EHLO, MAIL FROM, RCPT TO, DATA)
  • Email validation for local domain (@abby.md)
  • Support for concurrent connections using goroutines
  • MX record lookup
  • Custom CRLF scanning for proper SMTP protocol handling

Installation

git clone <repository-url>
cd gtsmail
go build

Usage

To start the SMTP server:

sudo go run main.go

Note: Running on port 25 requires root/administrator privileges, and ISP restrictions may apply.

Email Forwarding

The program includes functionality to:

  • Look up MX records for recipient domains
  • Forward emails to appropriate mail servers
  • Handle multiple MX records with priority ordering
  • Support timeout and error handling

Testing

Run the included tests with:

go test ./...

File Structure

License

This project is available under the MIT License.

About

A bare-minimum TCP-level SMTP server implementation in Go for a server to send and receive emails.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages