Mail2Go

command module
v0.0.0-...-24b6712 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Mail2Go - Lightweight CLI SMTP client

License GitHub issues

Mail2Go is a very lightweight command-line SMTP client written in Go, designed to send emails from the command-line easily.

Table of Contents

Features

  • Send Emails with Ease: Quickly send emails with subject, body, and multiple recipients.
  • Attachments Support: Attach multiple files of various types to your emails.
  • HTML and Plain Text: Supports both HTML and plain text formats for email bodies.
  • Command Line Interface: Easy-to-use CLI arguments for configuring and sending emails.
  • Flexible Configuration: SMTP server, TLS, port, username, and password can be configured through CLI arguments or a JSON configuration file.
  • Automatic Configuration File Detection: Will automatically search for a default configuration file in the user's config directory if no configuration file is provided (e.g., ~/.config/mail2go/config.json).

Requirements

  • Go 1.22 or higher recommended (for build).
  • Access to an SMTP server for sending emails.

Installation

  1. Download the Linux amd64 binary with wget (more versions on release tab):

    wget https://github.com/KeepSec-Technologies/Mail2Go/releases/download/1.2.0/mail2go_linux_amd64_1.2.0.tar.gz
    
  2. Unpack it with tar

    tar -xf mail2go_linux_amd64_1.2.0.tar.gz
    
  3. Move it to your /usr/local/bin/ (Optional):

    sudo mv mail2go /usr/local/bin/mail2go
    

Building from Source

  1. Ensure you have Go installed on your system. You can download Go from here.

  2. Clone the repository:

    git clone https://github.com/KeepSec-Technologies/Mail2Go
    
  3. Navigate to the cloned directory:

    cd Mail2Go
    
  4. Build the tool:

    CGO_ENABLED=0 go build -a -installsuffix cgo -o mail2go .
    

Usage

Run the Mail2Go tool with the required arguments:

-s, --smtp-server         SMTP server for sending emails
-p, --smtp-port           SMTP server port (Default: 587)
-u, --smtp-username       Username for SMTP authentication
-w, --smtp-password       Password for SMTP authentication
-na, --no-auth            No authentication required
-l, --tls-mode            TLS mode (none, tls-skip, tls)
-f, --from-email          Email address to send from

-c, --config              Path to the SMTP json config file which replaces the above arguments

-t, --to-email            Email addresses that will receive the email, comma-separated
-r, --reply-to            Email address to reply to (optional)
-h, --subject             Subject of the email
-b, --body                Body of the email
-af, --attachments        File paths for attachments, comma-separated (optional)
-bf, --body-file          File path for HTML email body (replaces the --body argument)
-v, --version             Application version

Examples

# Basic example:
mail2go -s mail.example.com -p 587 -u user@example.com -w password123 -l tls -f mail2go@example.com -t admin@example.com -h 'Test Mail2Go Subject' -b 'This is a body!' 

# Example with two recipients, the body from an HTML file and two attached files (can be more):
mail2go -s mail.example.com -p 587  -u user@example.com -w password123 -l tls -f mail2go@example.com -t admin@example.com,other@example.com -h 'Test Mail2Go Subject' -bf demo/body.html -af README.md,demo/mail2go-smaller.png

# Example with a reply-to address:
mail2go -s mail.example.com -p 587 -u user@example.com -w password123 -l tls -f mail2go@example.com -t admin@example.com -r replytome@example.com -h 'Test Mail2Go Subject' -b 'This is a body!'

# Example without authentication and no TLS:
mail2go -s mail.example.com -p 25 -l none -f mail2go@example.com -t admin@example.com -h 'Test Mail2Go Subject' -b 'This is a body!' 

# Example of a local SMTP server with a TLS certificate that can't be verified:
mail2go -s localhost -p 587 -u user@example.com -w password123 -l tls-skip -f mail2go@example.com -t admin@example.com -h 'Test Mail2Go Subject' -b 'This is a body!' 

Example of json configuration file to pass to Mail2Go:

{
    "smtp_server": "mail.example.com",
    "smtp_port": 587,
    "smtp_username": "user@example.com",
    "smtp_password": "password_example",
    "no_auth": false,
    "tls_mode": "tls",
    "from_email": "mail2go@example.com"
}

Example of the command that goes with it:

mail2go -c demo/config.json -t admin@example.com -h 'Test Mail2Go Subject' -b 'This is a body!' 

If you are using the default configuration file at ~/.config/mail2go/config.json it would look like this:

mail2go -t admin@example.com -h 'Test Mail2Go Subject' -b 'This is a body!' 

Note: CLI arguments will override configuration files (from the --config argument or the default location at ~/.config/mail2go/config.json).

Contributing

Contributions to Mail2Go are welcome. Please fork the repository and submit a pull request with your changes or improvements.

License

This project is licensed under MIT - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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