Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
[44;97;1m π€ Plandex [0;0;22m π Update SendVerificationEmail to use AWS SES in production βοΈ Edits: β’ app/server/email/email.go β Add AWS SDK imports for SES β Implement sending verification email using AWS SES in production β Add sendEmailViaSES function to handle email sending via AWS SES β’ infra/src/main.ts β Add comment to ensure SES policy allows sending emails
Dane Schneiderb7ceb6be6aca
diff --git a/app/server/email/email.go b/app/server/email/email.goindex 02e4227e..f098e7aa 100644--- a/app/server/email/email.go+++ b/app/server/email/email.go@@ -3,7 +3,9 @@ package emailimport ("fmt""os"-+ "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/atotto/clipboard""github.com/gen2brain/beeep")@@ -11,8 +13,11 @@ import (func SendVerificationEmail(email string, pin string) error {// Check if the environment is productionif os.Getenv("GOENV") == "production" {- // TODO: send email in production- return nil+ // Production environment - send email using AWS SES+ subject := "Your Verification Pin"+ htmlBody := fmt.Sprintf("<h1>Verification Pin</h1><p>Your verification pin is: <strong>%s</strong></p>", pin)+ textBody := fmt.Sprintf("Your verification pin is: %s", pin)+ return sendEmailViaSES(email, subject, htmlBody, textBody)}if os.Getenv("GOENV") == "development" {@@ -32,3 +37,49 @@ func SendVerificationEmail(email string, pin string) error {return nil}++// sendEmailViaSES sends an email using AWS SES+func sendEmailViaSES(recipient, subject, htmlBody, textBody string) error {+ // Create a new session in the us-west-2 region.+ // Replace us-west-2 with the AWS Region you're working with.+ sess, err := session.NewSession(&aws.Config{+ Region: aws.String("us-west-2"),+ })+ if err != nil {+ return fmt.Errorf("error creating AWS session: %v", err)+ }++ // Create an SES session.+ svc := ses.New(sess)++ // Assemble the email.+ input := &ses.SendEmailInput{+ Destination: &ses.Destination{+ ToAddresses: []*string{+ aws.String(recipient),+ },+ },+ Message: &ses.Message{+ Body: &ses.Body{+ Html: &ses.Content{+ Charset: aws.String("UTF-8"),+ Data: aws.String(htmlBody),+ },+ Text: &ses.Content{+ Charset: aws.String("UTF-8"),+ Data: aws.String(textBody),+ },+ },+ Subject: &ses.Content{+ Charset: aws.String("UTF-8"),+ Data: aws.String(subject),+ },+ },+ Source: aws.String("[email protected]"), // Replace with your "From" address+ }++ // Attempt to send the email.+ _, err = svc.SendEmail(input)++ return err+}diff --git a/infra/src/main.ts b/infra/src/main.tsindex 17a26e95..0b6f07bc 100644--- a/infra/src/main.ts+++ b/infra/src/main.ts@@ -198,7 +198,7 @@ export class PlandexStack extends cdk.Stack {const taskRole = new iam.Role(this, `plandex-task-role-${tag}`, {assumedBy: new iam.ServicePrincipal("ecs-tasks.amazonaws.com"),managedPolicies: [- iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonSESFullAccess"),+ iam.ManagedPolicy.fromAwsManagedPolicyName("AmazonSESFullAccess"), // Ensure this policy allows sending emails],});