1

I am working on an task in which i have to send pdf file as attachment in email, i'm using the Golang AWS SES-v2 package for sending emails. Earlier i was just sending all the emails without any attachment which consists of subject and body.

input := &sesv2.SendEmailInput{
    Destination: &types.Destination{
        CcAddresses: []string{},
        ToAddresses: []string{"receiver@example.com"},
    },
    Content: &types.EmailContent{
        Simple: &types.Message{
            Body: &types.Body{
                Html: &types.Content{
                    Charset: aws.String(CharSet),
                    Data:    aws.String(emailData["body"]),
                },
            },
            Subject: &types.Content{
                Charset: aws.String(CharSet),
                Data:    aws.String(emailData["subject"]),
            },
        },
    }

But as per my new requirement i want to send email along with pdf file as attachment, i tried searching and i have found that we can send attachments using Raw method, but is there any other way to send Pdf as attachment in email using the aws sesv2.

rohit
  • 89
  • 5
  • The package document of [aws sesv2](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/sesv2#Client.SendEmail) says `Raw - .... You can use this message type to send messages that contain attachments`. I'm afraid this is the only way to send attachments. – Zeke Lu Jun 20 '23 at 15:00

1 Answers1

0

You may use presigned urls and store the pdfs on S3.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jun 25 '23 at 18:08