百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

mailsend-go

> 编程语言
开源

mailsend-go 是一款跨平台的命令行工具,用于通过 SMTP 协议发送邮件

192 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

mailsend-go 是一款跨平台的命令行工具,用于通过 SMTP 协议发送邮件

Table Of Contents

  • Introduction
  • XOAUTH2 support
  • Features
  • Contributing
  • Synopsis
  • Vulnerability Check
  • Version 1.0.12 (May-16-2026)
  • Downloading and Installing
    • Installing using Scoop on Windows
    • Installing using Winget on Windows
    • Installing using Homebrew on Mac
      • Installing
      • Updating
      • Uninstalling
  • Compiling from source
  • Examples
    • Show SMTP server information
      • StartTLS will be used if server supports it
      • Use SSL. Note the port is different
      • Print SMTP server certificate chain
      • Use default settings for well known mail providers
    • Send mail with a text message
    • Send mail with a HTML message
    • Send mail with a HTML message, use XOAUTH2
    • Attach a PDF file
    • Attach a PDF file and an image
    • Attach a PDF file and embed an image
    • Set Carbon Copy and Blind Carbon copy
    • Send mail to a list of users
    • Add Custom Headers
    • Write logs to a file
    • Specify a different character set
  • Frequently Asked Questions (FAQ)
  • License (is MIT)
  • See Also

Introduction

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

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.

Features

  • Add a mail body
  • Support Multiple Attachments
  • Supports ESMTP Authentication
  • Supports StartTLS and SSL
  • Send mail to a list of users
  • Show SMTP server info etc.

Contributing

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)

Synopsis

…

Vulnerability Check

➤ 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

Version 1.0.12 (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.

Downloading and Installing

Pre-compiled mailsend-go binaries are available for the following platforms:

  • Windows - 32 and 64 bit (zip, Scoop, Winget)
  • Linux - 64 bit (tgz)
  • MacOS - 64 bit (tgz, Homebrew)
  • Raspberry pi - 32 bit (tgz)

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

Installing using Scoop on Windows

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

  • Install
scoop install mailsend-go
  • Update
scoop update mailsend-go
  • Remove
scoop uninstall mailsend-go
  • Misc
scoop list
scoop status
scoop info mailsend-go
scoop cat mailsend-go

Installing using Winget on Windows

You can install mailsend-go with Winget on Windows:

winget install muquit.mailsend-go

Installing using Homebrew on Mac

You will need to install Homebrew first. Note: Homebrew formula will be avilable only for released versions of mailsend-go

Installing

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

Updating

brew upgrade mailsend-go

Uninstalling

brew uninstall mailsend-go

To remove the tap:

brew untap muquit/formulae

Compiling from source

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

Examples

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.

Show SMTP server information

StartTLS will be used if server supports it

  mailsend-go -info -smtp smtp.gmail.com -port 587
…

Use SSL. Note the port is different

  mailsend-go -info -smtp smtp.gmail.com -port 465 -ssl

Print SMTP server certificate chain

  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
…

Use default settings for well known mail providers

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

Send mail with a text message

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.

Send mail with a HTML message

    mailsend-go -sub "Test"  \
    -smtp smtp.gmail.com -port 587 \
    auth \
     -user j

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言