Golang AWS SES email bad sender

Issue

I am using the AWS SES SDK for Golang and it works as planned, but the only issue I have is that I send my emails from hi@domain.com so when the email is received in the from place I see hi instead of the domain name which I would prefer and I can’t seem to find an easy fix for it. Has anyone encountered this? I think there should be an easy way to solve the issue. My code is almost identical to the linked sample in the SDK.

Solution

While providing FromEmailAddress in SendEmailInput struct try to use the following format Nice sender name <sender@example.com>, so to have the domain name you could have:

fromEmailAddress := "Example.com <sender@example.com>"
sesv2.SendEmailInput {
  FromEmailAddress: &fromEmailAddress, 
}

Answered By – Sebastian

Answer Checked By – Robin (GoLangFix Admin)

Leave a Reply

Your email address will not be published.