Email API Integration Guide with Golang

Minimum code that you need to integrate Mailazy with your Golang application


Prerequisites

You need to complete these given prerequisites, you can skip the step if you have already completed.

  1. Sign up for a Mailazy account.
  2. Complete Domain Authentication.
  3. Generate the Mailazy Access Key

Integrate Mailazy with Golang

  • Confirm that you are using supported go version (1.14 or higher)
  • Install the package via
import "github.com/mailazy/mailazy-go"
  • Start Sending mail using the code provided below:
senderClient := mailazy.NewSenderClient("access_key", "access_secret")
to := "[email protected]"
from := "Sender <[email protected]>"
subject := "Sending with mailazy is easy!"
textContent := ""
htmlContent := ""
req := mailazy.NewSendMailRequest(to, from, subject, textContent, htmlContent)
resp, err := senderClient.Send(req)