gomail is a robust mail sending utility written in Go, designed to simplify email delivery with support for attachments, templates, and flexible recipient management.
- Go >= 1.24.0
gomail provides comprehensive email functionality:
- 📎 Attachments - Send multiple file attachments with ease
- 📝 HTML and Text Templates - Support for both HTML and plain text content
- 👥 Recipient Management - Advanced recipient parsing with CC support
- 🔍 Filtering - Email domain filtering capabilities
- 🧪 Dry Run Mode - Validate recipients without sending
# Clone the repository
git clone https://github.com/craftslab/gomail.git
# Navigate to the project directory
cd gomail
# Build the project
make buildThe compiled binaries will be available in the bin/ directory.
Parse and filter recipient email addresses:
./parser \
--config="config/parser.json" \
--filter="@example1.com,@example2.com" \
--recipients="alen,cc:bob@example.com"Send emails with various options:
./sender \
--config="config/sender.json" \
--attachment="attach1.txt,attach2.txt" \
--body="body.txt" \
--content_type="PLAIN_TEXT" \
--header="Your Name" \
--recipients="alen@example.com,bob@example.com,cc:catherine@example.com" \
--title="TITLE"Note: The --header option specifies the display name for the sender. The actual From email address is taken from the sender field in the config file. For example, if config contains "sender": "noreply@example.com" and you use --header="Your Name", the From header will be: "Your Name" <noreply@example.com>.
Description: Parse and filter email recipients
usage: parser --recipients=RECIPIENTS [<flags>]
Recipient parser
Flags:
--help Show context-sensitive help (also try --help-long
and --help-man).
--version Show application version.
-c, --config=CONFIG Config file, format: .json
-f, --filter=FILTER Filter list, format: @example1.com,@example2.com
-r, --recipients=RECIPIENTS Recipients list, format: alen,cc:bob@example.comDescription: Send emails with attachments and templates
usage: sender --recipients=RECIPIENTS [<flags>]
Mail sender
Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
--version Show application version.
-a, --attachment=ATTACHMENT Attachment files, format: attach1,attach2,...
-b, --body=BODY Body text or file
-c, --config=CONFIG Config file, format: .json
-e, --content_type=PLAIN_TEXT Content type, format: HTML or PLAIN_TEXT
(default)
-r, --header=HEADER Sender display name (used with sender address
from config file)
-p, --recipients=RECIPIENTS Recipients list, format:
alen@example.com,cc:bob@example.com
-t, --title=TITLE Title text
-n, --dry-run Only output recipient validation JSON and exit;
do not sendThis project is licensed under the terms specified in the LICENSE file.
- rsmail - Related mail project
Made with ❤️ by craftslab