Skip to content

A Go package for interacting with the MailPace API for sending emails.

License

Notifications You must be signed in to change notification settings

mailpace/gomailpace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GoMailpace

GoDoc GoReport Build Status Coverage Status License Go Version GitHub release

This Go package provides a client for interacting with the MailPace API for sending emails.

Installation

To use this package in your Go project, you can import it using the following:

import "github.com/mailpace/gomailpace"
import "context"

Usage

Creating a GoMailpace Client

emailClient := gomailpace.NewClient("MAILPACE_TOKEN")

Replace "MAILPACE_TOKEN" with your actual MailPace API token.

Sending an Email

emailPayload := gomailpace.Payload{
    From:     "[email protected]",
    To:       "[email protected]",
    Subject:  "MailPace Rocks!",
    TextBody: "MailPace is the best transactional email provider out there",
}

ctx := context.Background() // You can use context to handle request cancellation, deadlines etc.
err := emailClient.Send(ctx, emailPayload)
if err != nil {
    // handle err
}

Additional Options

You can include various options such as HTML body, CC, BCC, attachments, tags, etc. as specified in the MailPace API documentation: https://docs.mailpace.com/reference/send

emailPayload := gomailpace.Payload{
    From:        "[email protected]",
    To:          "[email protected]",
    Subject:     "MailPace Rocks!",
    HTMLBody:    "<html><body><p>Content</p></body></html>",
    CC:          "[email protected]",
    Attachments: []gomailpace.Attachment{
        {
            Name:        "attachment.jpg",
            Content:     "base64_encoded_string_here",
            ContentType: "image/jpeg",
        },
    },
    Tags: []string{"password reset", "welcome"},
}

Running Tests

To run the unit tests for this package, use the following command:

go test

Contributions

Feel free to contribute to this project by opening issues or submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

A Go package for interacting with the MailPace API for sending emails.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages