I need to implement Amazon ses SendRawEmail with attachment in golang,
i tried with the following code :
session, err := session.NewSession()
svc := ses.New(session, &aws.Config{Region: aws.String("us-west-2")})
source := aws.String("XXX <xxx@xxx.com>")
destinations := []*string{aws.String("xxx <xxx@xxx.com>")}
message := ses.RawMessage{ Data: []byte(` From: xxx <xxx@xxx.com>\
To: xxx <xxx@xxx.com>\
Subject: Test email (contains an attachment)\
MIME-Version: 1.0\
Content-type: Multipart/Mixed; boundary=\"NextPart\"\
\
--NextPart\
Content-Type: text/plain\
\
This is the message body.\
\
--NextPart\
Content-Type: text/plain;\
Content-Disposition: attachment; filename=\"sample.txt\"\
\
This is the text in the attachment.\
\
--NextPart--" `)}
input := ses.SendRawEmailInput{Source: source, Destinations: destinations, RawMessage: &message}
output, err := svc.SendRawEmail(&input)
but in the mail I receive, it shows the content which I have given in the message, instead of the attachment. Not sure what exactly is wrong???