Skip to content

bennovw/mailtrap-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mailtrap-go

Go Reference Go codecov Go Report Card

Unofficial Mailtrap API client for Go.

The public API documentation is available at https://api-docs.mailtrap.io.

Installation

go get github.com/bennovw/mailtrap-go

Usage

import "github.com/bennovw/mailtrap-go"

Create a new Mailtrap client, then use the exposed services to access different parts of the Mailtrap API.

package main

import (
    "log"

    "github.com/bennovw/mailtrap-go"
)

func main() {
    // Production Mailtrap client
    client, err := mailtrap.NewSendingClient("api-token")
    if err != nil {
        log.Fatal(err)
    }

    email := &mailtrap.SendEmailRequest{ ... }
    resp, _, err := client.SendEmail.Send(email)

    // Sandbox Mailtrap client (for testing)
    sandboxClient, err := mailtrap.NewSandboxSendingClient("api-token", "000001")
    if err != nil {
        log.Fatal(err)
    }
    resp, _, err := sandboxClient.SendEmail.Send(email)
}

Examples

To find code examples that demonstrate how to call the Mailtrap API client for Go, see the examples folder.

License

MIT License

About

Unofficial Mailtrap API client for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.3%
  • Makefile 0.7%