{"id":13564204,"url":"https://github.com/muquit/mailsend-go","last_synced_at":"2026-01-25T03:32:06.222Z","repository":{"id":55613394,"uuid":"167734369","full_name":"muquit/mailsend-go","owner":"muquit","description":"mailsend-go is a multi-platform  command line tool to send mail via SMTP protocol","archived":false,"fork":false,"pushed_at":"2025-11-13T02:53:32.000Z","size":562,"stargazers_count":182,"open_issues_count":39,"forks_count":21,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-11-13T04:20:17.157Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muquit.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/supported_platforms.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-01-26T20:15:00.000Z","updated_at":"2025-11-13T02:53:37.000Z","dependencies_parsed_at":"2024-01-14T03:48:18.331Z","dependency_job_id":"92b0a43c-b129-493d-9ef1-c9888b6e228e","html_url":"https://github.com/muquit/mailsend-go","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/muquit/mailsend-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muquit%2Fmailsend-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muquit%2Fmailsend-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muquit%2Fmailsend-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muquit%2Fmailsend-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muquit","download_url":"https://codeload.github.com/muquit/mailsend-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muquit%2Fmailsend-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28742975,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T02:46:29.005Z","status":"ssl_error","status_checked_at":"2026-01-25T02:44:29.968Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:27.944Z","updated_at":"2026-01-25T03:32:06.215Z","avatar_url":"https://github.com/muquit.png","language":"Go","readme":"[![Downloads](https://img.shields.io/github/downloads/muquit/mailsend-go/total.svg)](https://github.com/muquit/mailsend-go/releases)\n\n## Page Contents\n- [Introduction](#introduction)\n- [Features](#features)\n- [Contributing](#contributing)\n- [Synopsis](#synopsis)\n- [Vulnerability Check](#vulnerability-check)\n- [Version](#version)\n- [Downloading and Installing](#downloading-and-installing)\n  - [Installing using Homebrew on Mac](#installing-using-homebrew-on-mac)\n    - [Install](#install)\n    - [Uninstall](#uninstall)\n  - [Installing the debian package on Ubuntu or Debian or Raspberry pi](#installing-the-debian-package-on-ubuntu-or-debian-or-raspberry-pi)\n    - [Inspect the package content](#inspect-the-package-content)\n    - [Install](#install-1)\n    - [Uninstall](#uninstall-1)\n  - [Install the RPM package](#install-the-rpm-package)\n    - [Inspect the package content](#inspect-the-package-content-1)\n    - [Install/Upgrade](#installupgrade)\n    - [Uninstall](#uninstall-2)\n  - [Install from archive](#install-from-archive)\n    - [Inspect the content](#inspect-the-content)\n    - [Install Linux](#install-linux)\n    - [Install Windows](#install-windows)\n      - [Installing using Scoop on Windows](#installing-using-scoop-on-windows)\n        - [Install](#install-2)\n        - [Uninstall](#uninstall-3)\n      - [Installing Manually](#installing-manually)\n- [Compiling](#compiling)\n- [Docker](#docker)\n- [Examples](#examples)\n  - [Show SMTP server information](#show-smtp-server-information)\n    - [StartTLS will be used if server supports it](#starttls-will-be-used-if-server-supports-it)\n    - [Use SSL. Note the port is different](#use-ssl-note-the-port-is-different)\n    - [Print SMTP server certificate chain](#print-smtp-server-certificate-chain)\n    - [Use default settings for well known mail providers](#use-default-settings-for-well-known-mail-providers)\n  - [Send mail with a text message](#send-mail-with-a-text-message)\n  - [Send mail with a HTML message](#send-mail-with-a-html-message)\n  - [Attach a PDF file](#attach-a-pdf-file)\n  - [Attach a PDF file and an image](#attach-a-pdf-file-and-an-image)\n  - [Attach a PDF file and embed an image](#attach-a-pdf-file-and-embed-an-image)\n  - [Set Carbon Copy and Blind Carbon copy](#set-carbon-copy-and-blind-carbon-copy)\n  - [Send mail to a list of users](#send-mail-to-a-list-of-users)\n  - [Add Custom Headers](#add-custom-headers)\n  - [Write logs to a file](#write-logs-to-a-file)\n  - [Specify a different character set](#specify-a-different-character-set)\n- [Frequently Asked Questions (FAQ)](#frequently-asked-questions-faq)\n- [License (is MIT)](#license-is-mit)\n- [See Also](#see-also)\n\n# Introduction\n\n`mailsend-go` is a command line tool to send mail via SMTP protocol. This is the\n[golang](https://golang.org/) incarnation of my C version of\n[mailsend](https://github.com/muquit/mailsend/). However, this version is much\nsimpler and all the heavy lifting is done by the package\n[gomail.v2](https://gopkg.in/gomail.v2). However, this package is not maintained anymore. Therefore, I forked it to\n[gomail](https://github.com/muquit/gomail) (starting from mailsend-go v1.0.11-b1 Aug-24-2025).\nThe main purpose of this fork is to add XOAUTH2 support (Bug #68)\n\nIf you use [mailsend](https://github.com/muquit/mailsend), please consider\nusing mailsend-go as no new features will be added to \n[mailsend](https://github.com/muquit/mailsend).\n\nIf you have any question, request or suggestion, please enter it in the \n[Issues](https://github.com/muquit/mailsend-go/issues) with appropriate label.\n\n**NOTE:** XOAUTH2 support is available in v1.0.11-b1 (Released on Aug-24-2025)\n\nPlease look at [ChangeLog](ChangeLog.md) for what has changed in the current version.\n\n# Features\n\n* Add a mail body\n* Support Multiple Attachments\n* Supports ESMTP Authentication\n* Supports StartTLS and SSL\n* Send mail to a list of users\n* Show SMTP server info\n* Fixes [issues of mailsend](https://github.com/muquit/mailsend#known-issues)\n\n# Contributing\n\nPlease send a pull request if you add features, fix bugs or update the documentation. \n\nIf you want to update the documentation, **please do not update README.md directly**, \nrather update the Markdown files in _docs/_ directory. README.md \nis generated by [markdown_helper](https://github.com/BurdetteLamar/markdown_helper) ruby gem by\nassembling the individual Markdown files in the _docs/_ directory. If you\nwould like to generate README.md, type `make gen` (you will need required tools of\ncourse)\n\n# Synopsis\n```\n Version: @($) mailsend-go v1.0.11-b2\n https://github.com/muquit/mailsend-go\n Compiled with go version: go1.25.1\n\n mailsend-go [options]\n  Where the options are:\n  -debug                 - Print debug messages\n  -sub subject           - Subject\n  -t to,to..*            - email address/es of the recipient/s. Required\n  -list file             - file with list of email addresses. \n                           Syntax is: Name, email_address\n  -fname name            - name of sender\n  -f address*            - email address of the sender. Required\n  -cc cc,cc..            - carbon copy addresses\n  -bcc bcc,bcc..         - blind carbon copy addresses\n  -rt rt                 - reply to address\n  -smtp host/IP          - hostname/IP address of the SMTP server. Required\n                           unless '-use' is set.\n  -use mailprovider      - Arranges -smtp, -port and -ssl for you when using\n                           a well known mailprovider. Allowed values:\n                           gmail, yahoo, outlook, gmx, zoho, aol\n  -port port             - port of SMTP server. Default is 587\n  -domain domain         - domain name for SMTP HELO. Default is localhost\n  -info                  - Print info about SMTP server and exit\n  -printCerts            - Print Certificates in connection with -info. Default is No\n  -ssl                   - SMTP over SSL. Default is StartTLS\n  -verifyCert            - Verify Certificate in connection. Default is No\n  -ex                    - show examples\n  -help                  - show this help\n  -q                     - quiet\n  -log filePath          - write log messages to this file\n  -cs charset            - Character set for text/HTML. Default is utf-8\n  -V                     - show version and exit\n  auth                   - Auth Command\n   -user username*       - For basic auth: username for ESMTP authentication\n                           For OAuth2: email address of the authenticated account\n                           Required for both auth methods\n   -pass password*       - password for ESMTP authentication. Required for basic auth\n   -oauth2               - Use OAuth2 XOAUTH2 authentication instead of basic auth\n   -token access_token*  - OAuth2 access token. Required when -oauth2 is used\n  body                   - body command for attachment for mail body\n   -msg msg              - message to show as body \n   -file path            - or path of a text/HTML file\n   -mime-type type       - MIME type of the body content. Default is detected\n  attach                 - attach command. Repeat for multiple attachments\n   -file path*           - path of the attachment. Required\n   -name name            - name of the attachment. Default is filename\n   -mime-type type       - MIME-Type of the attachment. Default is detected\n   -inline               - Set Content-Disposition to \"inline\". \n                           Default is \"attachment\"\n  header                 - Header Command. Repeat for multiple headers\n   -name header          - Header name\n   -value value          - Header value\n\nThe options with * are required. \n\nEnvironment variables:\n   SMTP_USER_PASS for auth password (-pass)\n   SMTP_OAUTH_TOKEN for OAuth2 access token (-token)\n\n```\n\n# Vulnerability Check\n\n```\n➤ govulncheck --version\nGo: go1.25.1\nScanner: govulncheck@v1.1.4\nDB: https://vuln.go.dev\nDB updated: 2025-09-24 19:21:41 +0000 UTC\n\nNo vulnerabilities found.\n```\n\n```\n➤ govulncheck -show verbose ./...\nFetching vulnerabilities from the database...\n\nChecking the code against the vulnerabilities...\n\nThe package pattern matched the following 2 root packages:\n  github.com/muquit/mailsend-go/pkg/version\n  github.com/muquit/mailsend-go\nGovulncheck scanned the following 2 modules and the go1.25.1 standard library:\n  github.com/muquit/mailsend-go\n  github.com/muquit/gomail@v0.0.0-20250704205629-a34fa7a15a08\n\nNo vulnerabilities found.\n```\n\n# Version\nThe current stable ersion of mailsend-go is 1.0.10, released on Dec-06-2020 \n\nThe current beta version is v1.0.11-b2.  Note: v1.0.11-b1 was\nthe first cut with support for SMTP XOAUTH2\n\nPlease look at [ChangeLog](ChangeLog.md) for what has changed in the current version.\n\n# Downloading and Installing\n\nPre-compiled `mailsend-go` binaries are available for the following platforms:\n\n* Windows - 32 and 64 bit (zip, Scoop)\n* Linux - 64 bit (tgz, debian and rpm)\n* MacOS - 64 bit (tgz, Homebrew)\n* Raspberry pi - 32 bit (debian, rpm)\n\nPlease download the binaries from the [releases](https://github.com/muquit/mailsend-go/releases)\npage.  \n\nPlease add an [issue](https://github.com/muquit/mailsend-go/issues) if you would need binaries for any other         platforms.\n\nBefore installing, please make sure to verify the checksum.\n\nWhen the tgz or zip archives are extracted they create a directory `mailsend-go-dir/` with the \ncontent.\n\n**Example**\n\n```\n    $ tar -tvf mailsend-go_x.x.x_linux_64-bit.tar.gz\n\t-rw-r--r--  0 muquit staff    1081 Jan 26 15:21 mailsend-go-dir/LICENSE.txt\n\t-rw-r--r--  0 muquit staff   14242 Jan 27 13:47 mailsend-go-dir/README.md\n\t-rw-r--r--  0 muquit staff   16866 Jan 27 13:47 mailsend-go-dir/docs/mailsend-go.1\n\t-rwxr-xr-x  0 muquit staff 5052992 Feb  9 19:23 mailsend-go-dir/mailsend-go\n```\n\n```\n\t$ unzip -l mailsend-go_x.x.x_windows_64-bit.zip\n\tArchive:  mailsend-go_x.x.x_windows_64-bit.zip\n\t  Length      Date    Time    Name\n\t---------  ---------- -----   ----\n\t\t 1081  01-26-2019 15:21   mailsend-go-dir/LICENSE.txt\n\t\t14242  01-27-2019 13:47   mailsend-go-dir/README.md\n\t\t16866  01-27-2019 13:47   mailsend-go-dir/docs/mailsend-go.1\n\t  4933632  02-09-2019 19:23   mailsend-go-dir/mailsend-go.exe\n\t---------                     -------\n\t  4965821                     4 files\n```\n\n## Installing using Homebrew on Mac\n\nYou will need to install [Homebrew](https://brew.sh/) first.\n\n### Install\n\nFirst install the custom tap.\n\n```\n    $ brew tap\n    $ brew untap muquit/mailsend-go\n    $ brew tap muquit/mailsend-go\n    $ brew install mailsend-go\n```\n\n### Uninstall\n```\n    $ brew uninstall mailsend-go\n```\n\n\n## Installing the debian package on Ubuntu or Debian or Raspberry pi\n\n### Inspect the package content\n```\n    $ dpkg -c mailsend-go_linux_64-bit.deb\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/share/\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/share/docs/\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/share/docs/mailsend-go/\n\t-rw-r--r-- 0/0            1081 2019-02-10 20:17 usr/local/share/docs/mailsend-go/LICENSE.txt\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/bin/\n\t-rwxr-xr-x 0/0         5052992 2019-02-10 20:17 usr/local/bin/mailsend-go\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/share/man/\n\tdrwxr-xr-x 0/0               0 2019-02-10 20:17 usr/local/share/man/man1/\n\t-rw-r--r-- 0/0           20896 2019-02-10 20:17 usr/local/share/man/man1/mailsend-go.1\n\t-rw-r--r-- 0/0           19236 2019-02-10 20:17 usr/local/share/docs/mailsend-go/README.md\n```\n\n### Install\n\n```\n    $ sudo dpkg -i mailsend-go_linux_64-bit.deb \n\tSelecting previously unselected package mailsend-go.\n\t(Reading database ... 4039 files and directories currently installed.)\n\tPreparing to unpack mailsend-go_linux_64-bit.deb ...\n\tUnpacking mailsend-go (x.x.x) ...\n\tSetting up mailsend-go (x.x.x) ...\n    $ mailsend-go -V\n    @(#) mailsend-go vx.x.x\n```\n\n### Uninstall\n\n```\n    $ sudo dpkg -r mailsend-go\n```\n\n## Install the RPM package\n\n### Inspect the package content\n```\n    $ rpm -qlp mailsend-go_linux_64-bit.rpm\n    /usr/local/bin/mailsend-go\n    /usr/local/share/docs/mailsend-go/LICENSE.txt\n    /usr/local/share/docs/mailsend-go/README.md\n    /usr/local/share/man/man1/mailsend-go.1\n```\n### Install/Upgrade\n```\n    # rpm -Uvh mailsend-go_linux_64-bit.rpm\n    # mailsend-go -V\n    @(#) mailsend-go vx.x.x\n```\n### Uninstall\n```\n    # rpm -ev mailsend-go\n```\n\n## Install from archive\n\n### Inspect the content\n```\n    $ tar -tvf mailsend-go_x.x.x_linux_64-bit.tar.gz\n    -rw-r--r--  0 muquit staff    1081 Jan 26 15:21 mailsend-go-dir/LICENSE.txt\n    -rw-r--r--  0 muquit staff   14242 Jan 27 13:47 mailsend-go-dir/README.md\n    -rw-r--r--  0 muquit staff   16866 Jan 27 13:47 mailsend-go-dir/docs/mailsend-go.1\n    -rwxr-xr-x  0 muquit staff 5052992 Feb  9 19:23 mailsend-go-dir/mailsend-go\n```\n\n```\n    $ unzip -l mailsend-go_x.x.x_windows_64-bit.zip\n    Archive:  mailsend-go_x.x.x_windows_64-bit.zip\n      Length      Date    Time    Name\n    ---------  ---------- -----   ----\n     1081  01-26-2019 15:21   mailsend-go-dir/LICENSE.txt\n    14242  01-27-2019 13:47   mailsend-go-dir/README.md\n    16866  01-27-2019 13:47   mailsend-go-dir/docs/mailsend-go.1\n      4933632  02-09-2019 19:23   mailsend-go-dir/mailsend-go.exe\n    ---------                     -------\n      4965821                     4 files\n```\n\n### Install Linux\n```\n    $ tar -xf mailsend-go_x.x.x_linux_64-bit.tar.gz\n    $ sudo cp mailsend-go-dir/mailsend-go /usr/local/bin\n    $ sudo cp mailsend-go-dir/doc/mailsend-go.1 /usr/local/share/man/man1\n```\n\n### Install Windows\n\n#### Installing using Scoop on Windows\n\nYou will need to install [Scoop](https://scoop.sh/) first.\n\n##### Install\n\n```batch\nc:\\\u003e scoop install mailsend-go\n````\n\n##### Uninstall\n\n```batch\nc:\\\u003e scoop uninstall mailsend-go\n````\n\n#### Installing Manually\n\nAfter [downloading](#downloading-and-installing) the latest .zip file (e.g., mailsend-go_x.x.x_windows_64-bit.zip), unzip it, and copy `mailsend-go-dir\\mailsend-go.exe` somewhere in your PATH or run it from the directory.\n\n# Compiling\n\nCompiling from scratch requires the [Go programming language toolchain](https://golang.org/dl/) and git. Note: *mailsend-go* uses [go modules](https://github.com/golang/go/wiki/Modules) for dependency management.\n\nTo install the binary:\n\n```\n    $ go install github.com/muquit/mailsend-go@latest\n```\nThe binary will be installed at $GOPATH/bin/ directory.\n\n\nIf you see the error message `go: cannot find main module; see 'go help\nmodules'`, make sure GO111MODULE environment variable is not set to on. Unset it by\ntyping `unset GO111MODULE`\n\n\nTo compile yourself:\n\n```\n    $ git clone https://github.com/muquit/mailsend-go.git\n    $ cd mailsend-go\n    $ make\n    $ ./mailsend-go -V\n```\n\n* List the packages used (if you are outside $GOPATH)\n```\n    $ go list -m \"all\"\n    github.com/muquit/mailsend-go\n    github.com/muquit/gomail v0.0.0-20250327010414-6846ede5e07d\n    github.com/muquit/quotedprintable v0.0.0-20250204043250-71206103869d\n```\n\n# Docker\n\n* Building for docker can be done with ```docker build -t mailsend-go .```. This will also fetch the golang image and create a intermediate image (about 820MB in total). If space is a concern for you, remove them with ```docker rmi golang:1.13.7``` and ```docker image prune```\n\n* Running with docker can be done as any other docker image. Everything after the image name will be passed to the program. Example: ```docker run -it --rm mailsend-go -V``` will show the version\n\n# Examples\n\nEach example mailsend-go command is a single line. In Unix back slash \\ \ncan be used to continue in the next line. Also in Unix, use single quotes \ninstead of double quotes, otherwise if input has any shell character like \n$ etc, it will get expanded by the shell.\n\n## Show SMTP server information\n\n### StartTLS will be used if server supports it\n\n```\n  mailsend-go -info -smtp smtp.gmail.com -port 587\n```    \n\n```\n[S] 220 smtp.gmail.com ESMTP k185-v6sm17739711qkd.27 - gsmtp\n[C] HELO localhost\n[C] EHLO localhost\n[S] 250-smtp.gmail.com at your service, [x.x.x.x]\n[S] 250-SIZE 35882577\n[S] 250-8BITMIME\n[S] 250-STARTTLS\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-PIPELINING\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\n[C] STARTTLS\n[S] 220-2.0.0 Ready to start TLS\n[C] EHLO localhost\n[S] 250-smtp.gmail.com at your service, [x.x.x.x]\n[S] 250-SIZE 35882577\n[S] 250-8BITMIME\n[S] 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-PIPELINING\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\nCertificate of smtp.gmail.com:\n Version: 3 (0x3)\n Serial Number: 149685795415515161014990164765 (0x1e3a9301cfc7206383f9a531d)\n Signature Algorithm: SHA256-RSA\n Subject: CN=Google Internet Authority G3,O=Google Trust Services,C=US\n Issuer: GlobalSign\n Not before: 2017-06-15 00:00:42 +0000 UTC\n Not after: 2021-12-15 00:00:42 +0000 UTC\n[C] QUIT\n[S] 221-2.0.0 closing connection k185-v6sm17739711qkd.27 - gsmtp\n```\n\n### Use SSL. Note the port is different\n\n```\n  mailsend-go -info -smtp smtp.gmail.com -port 465 -ssl\n```\n\n### Print SMTP server certificate chain\n\n```bash\n  mailsend-go -info -smtp smtp.gmail.com -port 587 -printCerts\n```\n\n```bash\n[S] 220 smtp.gmail.com ESMTP 6a1803df08f44-80166e2f32bsm34741116d6.41 - gsmtp\n[C] HELO localhost\n[C] EHLO localhost\n[S] 250-smtp.gmail.com at your service, [x.x.x.x]\n[S] 250-SIZE 35882577\n[S] 250-8BITMIME\n[S] 250-STARTTLS\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-PIPELINING\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\n[C] STARTTLS\n[S] 220-2.0.0 Ready to start TLS\n[C] EHLO localhost\n[S] 250-smtp.gmail.com at your service, [x.x.x.x]\n[S] 250-SIZE 35882577\n[S] 250-8BITMIME\n[S] 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-PIPELINING\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\n[C] QUIT\n[S] 221-2.0.0 closing connection 6a1803df08f44-80166e2f32bsm34741116d6.41 - gsmtp\n\n=== TLS Connection Information ===\nTLS Version: TLS 1.3\nCipher Suite: 0x1301\nServer Name: smtp.gmail.com\nNegotiated Protocol:\n\nCertificate Chain (3 certificates):\n\n--- Certificate 1 ---\nSubject: CN=smtp.gmail.com\nIssuer: CN=WR2,O=Google Trust Services,C=US\nSerial Number: 14461562026188826353951632455228095006\nNot Before: 2025-09-08T08:36:45Z\nNot After: 2025-12-01T08:36:44Z\nIs CA: false\nDNS Names: smtp.gmail.com\nKey Usage: Digital Signature\nStatus: Valid\n\n--- Certificate 2 ---\nSubject: CN=WR2,O=Google Trust Services,C=US\nIssuer: CN=GTS Root R1,O=Google Trust Services LLC,C=US\nSerial Number: 170058220837755766831192027518741805976\nNot Before: 2023-12-13T09:00:00Z\nNot After: 2029-02-20T14:00:00Z\nIs CA: true\nKey Usage: Digital Signature, Certificate Sign, CRL Sign\nStatus: Valid\n\n--- Certificate 3 ---\nSubject: CN=GTS Root R1,O=Google Trust Services LLC,C=US\nIssuer: CN=GlobalSign Root CA,OU=Root CA,O=GlobalSign nv-sa,C=BE\nSerial Number: 159159747900478145820483398898491642637\nNot Before: 2020-06-19T00:00:42Z\nNot After: 2028-01-28T00:00:42Z\nIs CA: true\nKey Usage: Digital Signature, Certificate Sign, CRL Sign\nStatus: Valid\n\n--- Certificate Fingerprints (Leaf) ---\nSHA-1: 28:88:45:90:10:20:88:BA:87:2E:0E:7C:3A:12:D6:35:EC:26:AE:90\nSHA-256: 6F:F8:E2:F5:D4:AE:5A:FF:92:4A:5F:AC:88:80:14:3A:30:33:7A:CF:EE:33:94:82:EF:2A:93:47:80:E4:18:EF\n=====================================\n```\n\n```bash\n   mailsend-go -info -smtp smtp.gmail.com -port 465 -ssl -printCerts\n```\n\n```bash\n[S] 220 smtp.gmail.com ESMTP 6a1803df08f44-80166781d27sm35134546d6.45 - gsmtp\n[C] HELO localhost\n[C] EHLO localhost\n[S] 250-smtp.gmail.com at your service, [x.x.x.x]\n[S] 250-SIZE 35882577\n[S] 250-8BITMIME\n[S] 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-PIPELINING\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\n[C] QUIT\n[S] 221-2.0.0 closing connection 6a1803df08f44-80166781d27sm35134546d6.45 - gsmtp\n\n=== TLS Connection Information ===\nTLS Version: TLS 1.3\nCipher Suite: 0x1301\nServer Name: smtp.gmail.com\nNegotiated Protocol:\n\nCertificate Chain (3 certificates):\n\n--- Certificate 1 ---\nSubject: CN=smtp.gmail.com\nIssuer: CN=WR2,O=Google Trust Services,C=US\nSerial Number: 14461562026188826353951632455228095006\nNot Before: 2025-09-08T08:36:45Z\nNot After: 2025-12-01T08:36:44Z\nIs CA: false\nDNS Names: smtp.gmail.com\nKey Usage: Digital Signature\nStatus: Valid\n\n--- Certificate 2 ---\nSubject: CN=WR2,O=Google Trust Services,C=US\nIssuer: CN=GTS Root R1,O=Google Trust Services LLC,C=US\nSerial Number: 170058220837755766831192027518741805976\nNot Before: 2023-12-13T09:00:00Z\nNot After: 2029-02-20T14:00:00Z\nIs CA: true\nKey Usage: Digital Signature, Certificate Sign, CRL Sign\nStatus: Valid\n\n--- Certificate 3 ---\nSubject: CN=GTS Root R1,O=Google Trust Services LLC,C=US\nIssuer: CN=GlobalSign Root CA,OU=Root CA,O=GlobalSign nv-sa,C=BE\nSerial Number: 159159747900478145820483398898491642637\nNot Before: 2020-06-19T00:00:42Z\nNot After: 2028-01-28T00:00:42Z\nIs CA: true\nKey Usage: Digital Signature, Certificate Sign, CRL Sign\nStatus: Valid\n\n--- Certificate Fingerprints (Leaf) ---\nSHA-256: 6F:F8:E2:F5:D4:AE:5A:FF:92:4A:5F:AC:88:80:14:3A:30:33:7A:CF:EE:33:94:82:EF:2A:93:47:80:E4:18:EF\nSHA-1: 28:88:45:90:10:20:88:BA:87:2E:0E:7C:3A:12:D6:35:EC:26:AE:90\n=====================================\n```\n\n```bash\n    mailsend-go -info -smtp smtp-mail.outlook.com -port 587 -printCerts\n```\n\n```bash\n[S] 220 MN2PR01CA0065.outlook.office365.com Microsoft ESMTP MAIL Service ready at Sat, 27 Sep 2025 00:29:10 +0000 [08DDFAA3FED0C1E0]\n[C] HELO localhost\n[C] EHLO localhost\n[S] 250-MN2PR01CA0065.outlook.office365.com Hello [x.x.x.x]\n[S] 250-SIZE 157286400\n[S] 250-PIPELINING\n[S] 250-DSN\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-STARTTLS\n[S] 250-8BITMIME\n[S] 250-BINARYMIME\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\n[C] STARTTLS\n[S] 220-2.0.0 SMTP server ready\n[C] EHLO localhost\n[S] 250-MN2PR01CA0065.outlook.office365.com Hello [x.x.x.x]\n[S] 250-SIZE 157286400\n[S] 250-PIPELINING\n[S] 250-DSN\n[S] 250-ENHANCEDSTATUSCODES\n[S] 250-AUTH LOGIN XOAUTH2\n[S] 250-8BITMIME\n[S] 250-BINARYMIME\n[S] 250-CHUNKING\n[S] 250-SMTPUTF8\n[C] QUIT\n[S] 221-2.0.0 Service closing transmission channel\n\n=== TLS Connection Information ===\nTLS Version: TLS 1.3\nCipher Suite: 0x1302\nServer Name: smtp-mail.outlook.com\nNegotiated Protocol:\n\nCertificate Chain (2 certificates):\n\n--- Certificate 1 ---\nSubject: CN=outlook.com,O=Microsoft Corporation,L=Redmond,ST=Washington,C=US\nIssuer: CN=DigiCert Cloud Services CA-1,O=DigiCert Inc,C=US\nSerial Number: 10535063011692331098818316272276424549\nNot Before: 2025-03-29T00:00:00Z\nNot After: 2026-03-28T23:59:59Z\nIs CA: false\nDNS Names: *.clo.footprintdns.com, *.hotmail.com, *.internal.outlook.com, *.live.com, *.nrb.footprintdns.com, *.office.com, *.office365.com, *.outlook.com, *.outlook.office365.com, attachment.outlook.live.net, attachment.outlook.office.net, attachment.outlook.officeppe.net, attachments.office.net, attachments-sdf.office.net, ccs.login.microsoftonline.com, ccs-sdf.login.microsoftonline.com, hotmail.com, mail.services.live.com, office365.com, outlook.com, outlook.office.com, substrate.office.com, substrate-sdf.office.com\nKey Usage: Digital Signature, Key Encipherment\nStatus: Valid\n\n--- Certificate 2 ---\nSubject: CN=DigiCert Cloud Services CA-1,O=DigiCert Inc,C=US\nIssuer: CN=DigiCert Global Root CA,OU=www.digicert.com,O=DigiCert Inc,C=US\nSerial Number: 20058375873168194746987232153701302504\nNot Before: 2020-09-25T00:00:00Z\nNot After: 2030-09-24T23:59:59Z\nIs CA: true\nKey Usage: Digital Signature, Certificate Sign, CRL Sign\nStatus: Valid\n\n--- Certificate Fingerprints (Leaf) ---\nSHA-1: A6:F7:EC:FB:2B:F6:31:B3:A8:4F:EB:B0:9F:FD:BB:4E:3B:0F:42:11\nSHA-256: 4F:94:1A:8E:50:52:5E:09:24:4F:8F:FE:75:65:E1:6A:51:DD:10:47:04:74:94:6A:0F:BA:84:6A:86:E4:DE:8C\n=====================================\n```\n\n### Use default settings for well known mail providers\n\nDon't worry about the settings of -smtp, -port and -ssl for well known mail\nproviders. This works for gmail, yahoo, outlook, gmx, zoho and aol.\n\n      mailsend-go -info -use gmail\n\n## Send mail with a text message\n\nNotice \"auth\" is a command and it takes -user and -pass arguments. \"body\" is\nalso a command and here it took -msg as an argument. The command \"body\" can\nnot repeat, if specified more than once, the last one will be used.\n\n```\n    mailsend-go -sub \"Test\"  -smtp smtp.gmail.com -port 587 \\\n     auth \\\n      -user jsnow@gmail.com -pass \"secret\" \\\n     -from \"jsnow@gmail.com\" -to  \"mjane@example.com\" \\\n     body \\\n       -msg \"hello, world!\\nThis is a message\"\n```                    \nThe embedded new line \\\\n will be converted to a real newline and the final\nmessage will show up as two lines.\n\nThe environment variable \"SMTP_USER_PASS\" can be used instead of the flag\n`-pass`.\n\n## Send mail with a HTML message\n```\n    mailsend-go -sub \"Test\"  \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user jsnow@gmail.com -pass \"secret\" \\\n    -from \"jsnow@gmail.com\"  \\\n    -to  \"mjane@example.com\" -from \"jsnow@gmail.com\" \\\n    body \\\n     -msg \"\u003cb\u003ehello, world!\u003c/b\u003e\"\n```\n\n## Attach a PDF file\nMIME type will be detected. Content-Disposition will be set to \"attachment\",\nContent-Transfer-Encoding will be \"Base64\". Notice, \"attach\" is a command it\ntook -file as an arg. The command \"attach\" can repeat.\n```\n    mailsend-go -sub \"Test\"  \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user jsnow@gmail.com -pass \"secret\" \\\n    -from \"jsnow@gmail.com\"  \\\n    -to  \"mjane@example.com\" -from \"jsnow@gmail.com\" \\\n    body \\\n     -msg \"A PDF file is attached\" \\\n    attach \\\n     -file \"/path/file.pdf\"\n```\nThe name of the attachment will be file.pdf. To change the attachmetn name,\nuse the `-name` flag. e.g.\n\n```\n    attach -file \"/path/file.pdf\" -name \"report.pdf\"\n```\n\n## Attach a PDF file and an image\nNotice, the \"attach\" command is repeated here.\n```\n    mailsend-go -sub \"Test\"  \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user jsnow@gmail.com -pass \"secret\" \\\n    -from \"jsnow@gmail.com\"  \\\n    -to  \"mjane@example.com\" -from \"jsnow@gmail.com\" \\\n    body \\\n     -msg \"A PDF file and a PNG file is attached\" \\\n    attach \\\n     -file \"/path/file.pdf\" \\\n    attach \\\n     -file \"/path/file.png\"\n```\n## Attach a PDF file and embed an image\nContent-Disposition for the image will be set to \"inline\". It's an hint to the\nmail reader to display the image on the page. Note: it is just a hint, it is\nup to the mail reader to respect it or ignore it.\n```\n    mailsend-go -sub \"Test\"  \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user jsnow@gmail.com -pass \"secret\" \\\n    -from \"jsnow@gmail.com\"  \\\n    -to  \"mjane@example.com\" -from \"jsnow@gmail.com\" \\\n    body \\\n     -msg \"A PDF file is attached, image should be displayed inline\" \\\n    attach \\\n     -file \"/path/file.pdf\" \\\n    attach \\\n     -file \"/path/file.png\" \\\n     -inline\n```\n## Set Carbon Copy and Blind Carbon copy\n```\n    mailsend-go -sub \"Testing -cc and -bcc\" \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user example@gmail.com -pass \"secret\" \\\n     -to jsoe@example.com \\\n     -f \"example@gmail.com\" \\\n     -cc \"user1@example.com,user2@example.com\" \\\n     -bcc \"foo@example.com\" \\\n     body -msg \"Testing Carbon Copy and Blind Carbon copy\"\n```\nCc addresses will be visible to the recipients but Bcc address will not be.\n\n## Send mail to a list of users\n\nCreate a file with list of users. The syntax is ```Name,email_address``` in a line. Name can be empty but comma must be specified. Example of a list file:\n\n```\n    # This is a comment.\n    # The syntax is Name,email address in a line. Name can be empty but comma \n    # must be specified\n    John Snow,jsnow@example.com\n    Mary Jane,mjane@example.com\n    ,foobar@example.com\n```\n\nSpecify the list file with ```-list``` flag. \n\n```\n    mailsend-go -sub \"Test sending mail to a list of users\" \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user example@gmail.com -pass \"secret\" \\\n        -f \"me@example.com\" \\\n        -to \"xyz@example.com\" \\\n        body \\\n        -msg \"This is a test of sendmail mail to a list of users\" \\\n        attach \\\n            -file \"cat.jpg\" \\\n         attach \\\n            -file \"flower.jpg\" \\\n            -inline \\\n         -list \"list.txt\"\n```\n\n## Add Custom Headers\n\nUse the command \"header\" to add custom headers. The command \"header\" can be\nrepeated.\n\n```\n    mailsend-go -sub \"Testing custom headers\" \\\n    -smtp smtp.gmail.com -port 587 \\\n    auth \\\n     -user example@gmail.com -pass \"secret\" \\\n     -to jdoe@example.com \\\n     -f \"example@gmail.com\" \\\n     body -msg \"Testing adding Custom headers\"\n     header \\\n         -name \"X-MyHeader-1\" -value \"Value of X-MyHeader-1\" \\\n     header \\\n         -name \"X-MyHeader-2\" -value \"Value of X-MyHeader-2\"\n\n```\n\n## Write logs to a file\n\nUse the flag `-log path_of_log_file.txt`\n\n```\n    mailsend-go -sub \"test log\" \\\n     -smtp smtp.example.com -port 587 \\\n     auth \\\n      -user example@gmail.com -pass \"secret\" \\\n      -to jdoe@example.com \\\n      -f \"example@gmail.com\" \\\n      body -msg \"Testing log file\" \\\n      -log \"/tmp/mailsend-go.log\"\n```\n\n## Specify a different character set\n\nThe default character set is utf-8\n\n```\n    mailsend-go -sub \"test character set\" \\\n     -smtp smtp.example.com -port 587 \\\n     auth \\\n      -user example@gmail.com -pass \"secret\" \\\n      -to jdoe@example.com \\\n      -from \"example@gmail.com\" \\\n      -subject \"Testing Big5 Charset\" \\\n      -cs \"Big5\" \\\n      body -msg \"中文測試\"\n\n```\n\n---\n\n(Generated from docs/examples.md)\n\n---\n\n# Frequently Asked Questions (FAQ)\n\n**1. How to send mail via smtp.gmail.com?**\n\nFrom May 30, 2022, Google no longer supports the use of third-party apps to sign in to Google Account using username and password. However, an app-specific password can be set for mailsend-go to send mail via smtp.gmail.com. Here are the steps:\n\n- Login to your gmail account\n- Click on the Profile icon at the right side and then click on **Manage your Google Account**\n- Click on **Security** link from the list on the left sidebar.\n- Now you have to enable 2FA (Two Factor Authentication). Think carefully if you are going to do that for your main account. I used a test account and it does not seem to ask for 2FA code while sending email using smtp.gmail.com. However, it will require to enter 2FA code when you login to gmail.com. By default it sends 2FA code to your phone#, which is not secure. Configure to use Google Authenticator App instead for 2FA.\n- After 2FA is enabled, Click on **Security** link again. Select 2-Step Verification. Generate the app specific password by clicking on the **App Passwords** link. Specify mailsend-go as the app (I don't think it matters).\n- Use the username and this app specific password to send mail via smtp.gmail.com. It does not seem to ask for 2FA code.\n\nIf there are any gotchas or need more clarification, please send a pull request or update Issue #49 with your experience and I will update the FAQ.\n\n```\n-- updated: Jul-01-2022\n```\n\n# License (is MIT)\n\nLicense is MIT\n\nCopyright © 2018-2025 muquit@muquit.com\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the \"Software\"),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE\nOR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n# See Also\n\nOriginal [mailsend](https://github.com/muquit/mailsend) (in C)\n\n---\n* This file is assembled from docs/*.md with [markdown_helper](https://github.com/BurdetteLamar/markdown_helper)\n* The software is released with [go-xbuild-go](https://github.com/muquit/go-xbuild-go)\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuquit%2Fmailsend-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuquit%2Fmailsend-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuquit%2Fmailsend-go/lists"}