Skip to content

kopexa-grc/comms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Comms

Go Report Card License

Note: This is an internal library used within the Kopexa core ecosystem. It is not intended for public use.

Comms is a flexible and extensible email communication library for Go that enables easy integration with various email services. It is primarily used within Kopexa's internal services and applications.

Features

  • πŸš€ Easy integration with various email services
  • πŸ“§ Support for HTML and text emails
  • πŸ“Ž Attachment support
  • 🏷️ Tagging system for email categorization
  • πŸ”’ Email address validation
  • πŸ§ͺ Comprehensive test coverage

Installation

go get github.com/kopexa-grc/comms

Warning: This library is licensed under BUSL-1.1 and is intended for internal use within Kopexa. Please ensure you have the appropriate permissions and licensing before using this library.

Quick Start

package main

import (
    "context"
    "log"

    "github.com/kopexa-grc/comms"
    "github.com/kopexa-grc/comms/driver/resend"
)

func main() {
    // Configure Resend driver
    driver := resend.New("your-api-key")

    // Create Comms instance
    c := comms.New(
        comms.WithDriver(driver),
        comms.WithFrom("[email protected]"),
    )

    // Create recipient
    recipient := comms.NewRecipient(
        "[email protected]",
        "John",
        "Doe",
    )

    // Send email
    err := c.SendVerifyEmail(context.Background(), recipient, "123456")
    if err != nil {
        log.Fatal(err)
    }
}

Drivers

Resend

The Resend driver enables sending emails through the Resend service.

driver := resend.New("your-api-key")

Mock

The Mock driver is designed for testing purposes and simulates email sending.

driver := mock.NewDriver()

Templates

Comms supports HTML and text templates for emails. Templates are written in Go template syntax and can contain dynamic data.

Template Structure

templates/
β”œβ”€β”€ verify_email.html
└── verify_email.txt

Template Usage

text, html, err := comms.Render("verify_email", data)

Configuration

Options

  • WithDriver(driver.Driver): Sets the email driver
  • WithFrom(string): Sets the sender email address

Example

c := comms.New(
    comms.WithDriver(driver),
    comms.WithFrom("[email protected]"),
)

Development

Prerequisites

  • Go 1.21 or higher
  • Make

Build

make build

Tests

make test

Linting

make lint

License

This project is licensed under the BUSL-1.1 License. This license is specifically designed for internal use within Kopexa and its ecosystem.

Security

For security issues, please read our SECURITY.md file.

Contributing

Contributions are welcome! Please read our Contributing Guidelines for details.

Support

For questions or issues, please create an issue in the GitHub repository.

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •