# README

aws-sdk-go-v2-wrapper | SES

Quick Usage

import (
	"context"

	"github.com/evalphobia/aws-sdk-go-v2-wrapper/config"
	"github.com/evalphobia/aws-sdk-go-v2-wrapper/ses"
)

func main() {
	svc, err := ses.New(config.Config{
		AccessKey: "<...>",
		SecretKey: "<...>",
	})
	if err != nil {
		panic(err)
	}
	ctx := context.Background()


	// text email
	err = svc.XSendEmailText(ctx, "My email report", "I love you!", "[email protected]", "[email protected]")
	if err != nil {
		panic(err)
	}

	// HTML email
	htmlBody := `<!DOCTYPE html><html lang="en"><body><p style="text-align: center;">I love you!</p></body></html>`
	err = svc.XSendEmailHTML(ctx, "My email report", htmlBody, "[email protected]", "[email protected]")
	if err != nil {
		panic(err)
	}

	// send email with csv file
	err = svc.XSendRawEmail(ctx, ses.XSendRawEmailRequest{
		From:     "[email protected]",
		To:       []string{"[email protected]", "[email protected]"},
		Subject:  "nice subject",
		TextBody: "nice body",
		HTMLBody: "<!DOCTYPE html><html lang="en"><body><p style="text-align: center;">I love you!</p></body></html>",
		Attachments: []ses.XAttachment{
			{
				Data:                    []byte(base64.StdEncoding.EncodeToString([]byte(`date,count\n2020-01-01,100`))),
				Filename:                "foo.csv",
				MIMEType:                "text/csv",
				ContentTransferEncoding: "base64",
			},
		},
	})
	if err != nil {
		panic(err)
	}
	// ...
}

X API

NameDescription
XCreateTemplatecreates an email template.
XGetTemplategets an email template.
XExistsTemplatechecks if the template exists or not.
XUpdateTemplateupdates an email template.
XSendBulkTemplatedEmailsends bulk emails using a template.
XSendBulkTemplatedEmailEachListsends bulk emails from []string of email list.
XSendEmailHTMLsends HTML type email.
XSendEmailTextsends text type email.
XSendRawEmailsends email with easy option for attachment files.
XSendTemplatedEmailsends a email using a template.