notification

package
v0.0.78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package notification provides utilities for creating and sending email notifications through the RapidMail API. It includes functions for packaging HTML content into ZIP archives and sending email campaigns to recipients.

Features:

  • Create ZIP archives from HTML files for email content
  • Send email campaigns through RapidMail API
  • Support for scheduled email delivery
  • Base64 encoding of email content
  • Recipient list management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RapidMailCreateContentFromFile

func RapidMailCreateContentFromFile(htmlFilePath string) (string, error)

RapidMailCreateContentFromFile prepares HTML email content for RapidMail. This function creates a ZIP archive from an HTML file and encodes it in base64, which is the format required by the RapidMail API.

Parameters:

  • htmlFilePath: Path to the HTML file containing the email content

Returns:

  • string: Base64-encoded ZIP content
  • error: If any step in the process fails

The function:

  1. Creates a ZIP file containing the HTML file
  2. Reads the ZIP file content
  3. Encodes the content in base64
  4. Returns the encoded string

func RapidMailSend

func RapidMailSend(apiUser, apiPass, subject string, recipients []map[string]interface{}, htmlFilePath string) error

RapidMailSend sends an email campaign through the RapidMail API. This function creates and schedules an email campaign with the provided content and recipient list.

Parameters:

  • apiUser: RapidMail API username
  • apiPass: RapidMail API password
  • subject: Email subject line
  • recipients: List of recipient maps (each should contain "email" and optionally other fields)
  • htmlFilePath: Path to the HTML file containing the email content

Returns:

  • error: If any step in the process fails

The function:

  1. Prepares the email content by creating a ZIP and encoding it
  2. Creates a payload with campaign details and content
  3. Makes an authenticated POST request to the RapidMail API
  4. Logs the API response

Example recipient format:

[]map[string]interface{}{
    {"email": "recipient1@example.com", "firstname": "John", "lastname": "Doe"},
    {"email": "recipient2@example.com", "firstname": "Jane", "lastname": "Smith"},
}

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL