https://github.com/praserx/mailgo
SMTP easy to use wrapper library for Go apps.
https://github.com/praserx/mailgo
Last synced: 4 months ago
JSON representation
SMTP easy to use wrapper library for Go apps.
- Host: GitHub
- URL: https://github.com/praserx/mailgo
- Owner: praserx
- License: mit
- Created: 2023-04-01T07:58:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-18T11:41:11.000Z (12 months ago)
- Last Synced: 2025-06-18T12:41:18.758Z (12 months ago)
- Language: Go
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# mailgo
mailgo is a simple and easy-to-use SMTP wrapper library for Go applications. It provides a convenient interface for sending emails, including support for attachments, multiple recipients, and authentication.
## Features
- Send emails via SMTP with minimal setup
- Support for multiple recipients
- Send emails with or without authentication
- Add attachments to emails (since v1.4.0)
- Customizable email headers
- Error handling for each recipient
## Installation
```
go get github.com/mailgo
```
## Usage
```go
package main
import (
"github.com/mailgo"
)
func main() {
m := mailgo.NewMailer(mailgo.Options{
Host: "smtp.example.com",
Port: 587,
Username: "your_username",
Password: "your_password",
From: "your@email.com",
})
err := m.SendMail(mailgo.Message{
To: []string{"recipient1@example.com", "recipient2@example.com"},
Subject: "Test Email",
Body: "This is a test email sent using mailgo.",
Attachments: []string{"/path/to/file.pdf"}, // Optional: add attachments
})
if err != nil {
// handle error
}
}
```
## Options
- `Host`: SMTP server address
- `Port`: SMTP server port
- `Username`: SMTP username (optional for unauthenticated sending)
- `Password`: SMTP password (optional for unauthenticated sending)
- `From`: Sender email address
## Message
- `To`: List of recipient email addresses
- `Subject`: Email subject
- `Body`: Email body (plain text)
- `Attachments`: List of file paths to attach (optional)
## Changelog
See [CHANGELOG.md](CHANGELOG.md) for release notes.
## License
This project is licensed under the MIT License.