fix(ses): keep MailFromAttributes block when MAIL FROM is unconfigured (#1310)

GetEmailIdentity dropped the entire MailFromAttributes block for an
identity with no MAIL FROM domain configured, so an SDK caller saw
mailFromAttributes() == null on the emulator but non-null on real AWS.
AWS keeps the block carrying BehaviorOnMxFailure and omits only the
inner MailFromDomain / MailFromDomainStatus fields.

Clearing the MAIL FROM domain also resets BehaviorOnMxFailure to
UseDefaultValue, matching AWS, so a cleared identity is indistinguishable
from one that was never configured.
This commit is contained in:
Kenshin Okinaka authored and GitHub committed 2026-06-13 02:16:14 -05:00
1 parent e8e44e70bc
commit a032ec5ac0
4 files changed
+20 -7

No files matched your search

@@ -1088,12 +1088,12 @@ public class SesController {
result.set("DkimAttributes", buildDkimAttributes(identity));
ObjectNode mailFromAttributes = result.putObject("MailFromAttributes");
mailFromAttributes.put("BehaviorOnMxFailure", v1BehaviorToV2(identity.getBehaviorOnMxFailure()));
String mailFromDomain = identity.getMailFromDomain();
if (mailFromDomain != null && !mailFromDomain.isEmpty()) {
ObjectNode mailFromAttributes = result.putObject("MailFromAttributes");
mailFromAttributes.put("MailFromDomain", mailFromDomain);
mailFromAttributes.put("MailFromDomainStatus", toV2Status(identity.getMailFromDomainStatus()));
mailFromAttributes.put("BehaviorOnMxFailure", v1BehaviorToV2(identity.getBehaviorOnMxFailure()));
}
result.putObject("Policies");
@@ -474,7 +474,9 @@ public class SesService {
"Identity <" + identityValue + "> does not exist.", 400));
identity.setMailFromDomain(clearing ? null : mailFromDomain);
identity.setMailFromDomainStatus(clearing ? "Pending" : "Success");
if (normalizedBehavior != null) {
if (clearing) {
identity.setBehaviorOnMxFailure("UseDefaultValue");
} else if (normalizedBehavior != null) {
identity.setBehaviorOnMxFailure(normalizedBehavior);
}
identityStore.put(key, identity);