This Go package provides a client for interacting with the MailPace API for sending emails.
To use this package in your Go project, you can import it using the following:
import "github.com/mailpace/gomailpace"
import "context"
emailClient := gomailpace.NewClient("MAILPACE_TOKEN")
Replace "MAILPACE_TOKEN" with your actual MailPace API token.
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
}
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"},
}
To run the unit tests for this package, use the following command:
go test
Feel free to contribute to this project by opening issues or submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details