func (s *AmazonMailStrategy) Send(to, subject, body string) error {
	var source string
	emailSettings := s.conf
	if len(emailSettings.SenderAddress) == 0 {
		return errors.New("AmazonMailStrategy.config.SenderAddress is not set")
	}
	sess, err := session.NewSession(&aws.Config{
		Region: aws.String(emailSettings.AwsRegion)},
	)
	if err != nil {
		return errors.Wrap(err, "cannot create a session to AWS")
	}
	svc := ses.New(sess)
	source = fmt.Sprintf("%s <%s>",
		s.MIMEForEmailTitle(emailSettings.Charset, emailSettings.SenderName),
		emailSettings.SenderAddress)
	input := &ses.SendEmailInput{
		Destination: &ses.Destination{
			CcAddresses: []*string{},
			ToAddresses: []*string{
				aws.String(to),
			},
		},
		Message: &ses.Message{
			Body: &ses.Body{
				Html: &ses.Content{
					Charset: aws.String(emailSettings.Charset),
					Data:    aws.String(body),  
				},
				Text: &ses.Content{
					Charset: aws.String(emailSettings.Charset),
					Data:    aws.String(body),  
				},
			},
			Subject: &ses.Content{
				Charset: aws.String(emailSettings.Charset),
				Data:    aws.String(subject),
			},
		},
		Source: aws.String(source),
	}
	result, err := svc.SendEmail(input)
	log.WithFields(log.Fields{
		"to":          to,
		"subject":     subject,
		"body":        body,
		"emailConfig": emailSettings,
		"results":     result,
	}).Debug("utils.mail.send")
	if err != nil {
		return errors.Wrap(err, "internal server error: fail to send email")
	}
	return nil
}
Send is a pointer receiver function of AmazonMailStrategy,
which uses SES to send the mail
package services
import (
	"encoding/base64"
	"fmt"
	"mime"
	"net/mail"
	"net/smtp"
	"time"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/ses"
	"github.com/pkg/errors"
	log "github.com/sirupsen/logrus"
	"github.com/twreporter/go-api/configs"
	"github.com/twreporter/go-api/globals"
)
type MailService interface {
	Send(to, subject, body string) error
}
func NewAmazonMailService() MailService {
	return &AmazonMailStrategy{conf: globals.Conf.Email.Amazon}
}
type AmazonMailStrategy struct {
	conf configs.AmazonConfig
}
func (s *AmazonMailStrategy) MIMEForEmailTitle(charSet, title string) string {
	const encoding string = "B"  
	var encodedText = base64.StdEncoding.EncodeToString([]byte(title))
	return fmt.Sprintf("=?%s?%s?%s?=", charSet, encoding, encodedText)
}