mailsend-go 是一款跨平台的命令行工具,用于通过 SMTP 协议发送邮件
mailsend-go is a command line tool to send mail via SMTP protocol. This is the golang incarnation of my C version of mailsend. However, this version is much simpler and all the heavy lifting is done by the package gomail.v2 However, this package is not maintained anymore. Therefore, I forked it to gomail (starting from mailsend-go v1.0.11-b1 Aug-24-2025). The main purpose of this fork is to add XOAUTH2 support (Bug #68) but it also contains a security fix to prevent STARTTLS downgrade attack.
If you use mailsend , please consider using mailsend-go as no new features will be added to mailsend.
If you have any question, request or suggestion, please enter it in the Issues with appropriate label.
NOTE: XOAUTH2 support was added in v1.0.11-b1 (Released on Aug-24-2025)
Please look at ChangeLog for what has changed in the current version.
XOAUTH2 support is available in v1.0.11-b1 (Released on Aug-24-2025). mailsend-go itself does not implement full OAuth2 flow because implementing full OAuth2 would require managing web browser redirects, secure token storage across different platforms and maintaing state of token refresh cycles.
Therefore, I've created a companion tool called oauth-helper for token management. This separation keeps mailsend-go simple and secure while giving you full control over how tokens are obtained and stored. For automation, just pipe token from oauth-helper directly into mailsend-go.
Please visit oauth-helper page for details. It has examples on how to integrate with mailsend-go and XOAUTH2.
Please create an Issues if you need help or have any questions.
Please send a pull request if you add features, fix bugs or update the documentation.
If you want to update the documentation, please do not update README.md directly,
rather update the Markdown files in docs/ directory. README.md
is generated by markdown-toc-go assembling the individual Markdown files in the docs/ directory. If you
would like to generate README.md, type make gen (you will need required tools of
course)
…
➤ govulncheck --version
Go: go1.26.3
Scanner: [email protected]
DB: https://vuln.go.dev
DB updated: 2026-05-07 19:21:40 +0000 UTC
➤ govulncheck -show verbose ./...
Fetching vulnerabilities from the database...
Checking the code against the vulnerabilities...
The package pattern matched the following 2 root packages:
github.com/muquit/mailsend-go/pkg/version
github.com/muquit/mailsend-go
Govulncheck scanned the following 2 modules and the go1.26.3 standard library:
github.com/muquit/mailsend-go
github.com/muquit/[email protected]
No vulnerabilities found.
-- updated: May-16-2026
The current stable ersion of mailsend-go is 1.0.12, released on May-16-2026.
Please look at ChangeLog for what has changed in the current version.
Pre-compiled mailsend-go binaries are available for the following platforms:
Please download the binaries from the releases page.
Please add an Issues if you would need binaries for any other platforms.
Before installing, please make sure to verify the checksum.
When the tgz or zip archives are extracted they create a directory mailsend-go-dir/ with the
content.
Example
➤ tar -tvf bin/mailsend-go-v1.0.11-linux-amd64.d.tar.gz
-rw-r--r-- 0 muquit staff 1084 Jan 16 20:10 mailsend-go-v1.0.11-linux-amd64.d/LICENSE.txt
-rw-r--r-- 0 muquit staff 33880 Jan 16 20:10 mailsend-go-v1.0.11-linux-amd64.d/README.md
-rwxr-xr-x 0 muquit staff 5427384 Jan 16 20:10 mailsend-go-v1.0.11-linux-amd64.d/mailsend-go-v1.0.11-linux-amd64
-rw-r--r-- 0 muquit staff 34185 Jan 16 20:10 mailsend-go-v1.0.11-linux-amd64.d/mailsend-go.1
-rw-r--r-- 0 muquit staff 903 Jan 16 20:10 mailsend-go-v1.0.11-linux-amd64.d/platforms.txt
…
After extracting the archive, copy the binary somewhere in your PATH. Example:
sudo /bin/cp -fv \
mailsend-go-v1.0.11-linux-amd64.d/mailsend-go-v1.0.11-linux-amd64 \
/usr/local/bin/mailsend-go
sudo /bin/cp -fv \
mailsend-go-v1.0.11-linux-amd64.d/mailsend-go.1 \
/usr/share/main/man1
If you don't have Scoop installed, run in PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
For more information, see https://scoop.sh
scoop install mailsend-go
scoop update mailsend-go
scoop uninstall mailsend-go
scoop list
scoop status
scoop info mailsend-go
scoop cat mailsend-go
You can install mailsend-go with Winget on Windows:
winget install muquit.mailsend-go
You will need to install Homebrew first. Note: Homebrew formula will be avilable
only for released versions of mailsend-go
First install the custom tap.
brew tap muquit/formulae
brew install mailsend-go
Or use auto-tap (installs in one command):
brew install muquit/formulae/mailsend-go
Note: If you previously used the old dedicated tap (muquit/mailsend-go),
you may get an ambiguity error. Migrate to the new tap with:
brew uninstall mailsend-go
brew untap muquit/mailsend-go
brew install muquit/formulae/mailsend-go
brew upgrade mailsend-go
brew uninstall mailsend-go
To remove the tap:
brew untap muquit/formulae
Requires the Go programming language toolchain and git. mailsend-go uses Go modules for dependency management.
To install the binary:
$ go install github.com/muquit/mailsend-go@latest
The binary will be installed in $GOPATH/bin/.
To compile yourself:
$ git clone https://github.com/muquit/mailsend-go.git
$ cd mailsend-go
$ go build .
Or for platform-specific builds:
$ make linux
$ make mac
$ make windows
Run make help for all available targets.
To list the packages used:
$ go list -m "all"
github.com/muquit/mailsend-go
github.com/muquit/gomail v1.0.2
github.com/muquit/quotedprintable v0.0.0-20250204043250-71206103869d
Each example mailsend-go command is a single line. In Unix back slash \ can be used to continue in the next line. Also in Unix, use single quotes instead of double quotes, otherwise if input has any shell character like $ etc, it will get expanded by the shell. The directory test/ has some test scripts.
mailsend-go -info -smtp smtp.gmail.com -port 587
…
mailsend-go -info -smtp smtp.gmail.com -port 465 -ssl
mailsend-go -info -smtp smtp.gmail.com -port 587 -printCerts
…
mailsend-go -info -smtp smtp.gmail.com -port 465 -ssl -printCerts
…
mailsend-go -info -smtp smtp-mail.outlook.com -port 587 -printCerts
…
Don't worry about the settings of -smtp, -port and -ssl for well known mail providers. This works for gmail, yahoo, outlook, gmx, zoho and aol.
mailsend-go -info -use gmail
Notice "auth" is a command and it takes -user and -pass arguments. "body" is also a command and here it took -msg as an argument. The command "body" can not repeat, if specified more than once, the last one will be used.
mailsend-go -sub "Test" -smtp smtp.gmail.com -port 587 \
auth \
-user [email protected] -pass "secret" \
-from "[email protected]" -to "[email protected]" \
body \
-msg "hello, world!\nThis is a message"
The embedded new line \n will be converted to a real newline and the final message will show up as two lines.
The environment variable "SMTP_USER_PASS" can be used instead of the flag
-pass.
mailsend-go -sub "Test" \
-smtp smtp.gmail.com -port 587 \
auth \
-user j
暂无开放 Issues,或尚未同步最近议题。