Categorygithub.com/nothing2512/mailer
repositorypackage
1.0.3
Repository: https://github.com/nothing2512/mailer.git
Documentation: pkg.go.dev

# README

Mailer

Go-Mailer Plugins

Installation

go get -u github.com/nothing2512/mailer

Example Usage


package main

import (
    "github.com/nothing2512/mailer"
)

type Data struct {
    Name string `json:"name"`
}

func main() {
    m, err := mailer.Init("email", "pass", "host", "port")
	if err != nil {
		panic(err)
	}
	data := Data{"Fulan"}

	m.Subject("subject")

	m.Recipients("[email protected]")
	m.Cc("[email protected]", "[email protected]")
	m.Bcc("[email protected]", "[email protected]")

	m.SetHTMLFile("template.html", data)
	m.AttachFile("certificate.pdf", []byte{})

	err = m.Send()
	if err != nil {
		panic(err)
	}

	m.Close()
}