updated ses sender to consider adding label to from if provided

This commit is contained in:
Tim Chamberlain
2025-03-06 16:28:51 -06:00
parent 04e13413ef
commit e0045bb212

View File

@ -216,11 +216,16 @@ public class SendSESAction
{ {
LOG.warn("More than one FROM value was found, will send using the first one found [" + partyList.get(0).getAddress() + "]."); LOG.warn("More than one FROM value was found, will send using the first one found [" + partyList.get(0).getAddress() + "].");
} }
Party fromParty = partyList.get(0);
if(fromParty.getAddress() == null)
{
throw (new QException("Cannot send SES message because a FROM address was not provided."));
}
///////////////////////////// /////////////////////////////
// return the from address // // return the from address //
///////////////////////////// /////////////////////////////
return (partyList.get(0).getAddress()); return (getFullEmailAddress(fromParty));
} }
@ -267,15 +272,15 @@ public class SendSESAction
{ {
if(EmailPartyRole.CC.equals(party.getRole())) if(EmailPartyRole.CC.equals(party.getRole()))
{ {
ccList.add(party.getAddress()); ccList.add(getFullEmailAddress(party));
} }
else if(EmailPartyRole.BCC.equals(party.getRole())) else if(EmailPartyRole.BCC.equals(party.getRole()))
{ {
bccList.add(party.getAddress()); bccList.add(getFullEmailAddress(party));
} }
else if(party.getRole() == null || PartyRole.Default.DEFAULT.equals(party.getRole()) || EmailPartyRole.TO.equals(party.getRole())) else if(party.getRole() == null || PartyRole.Default.DEFAULT.equals(party.getRole()) || EmailPartyRole.TO.equals(party.getRole()))
{ {
toList.add(party.getAddress()); toList.add(getFullEmailAddress(party));
} }
else else
{ {
@ -332,4 +337,22 @@ public class SendSESAction
return amazonSES; return amazonSES;
} }
/*******************************************************************************
**
*******************************************************************************/
private String getFullEmailAddress(Party party)
{
if(party.getLabel() != null)
{
return (party.getLabel() + " <" + party.getAddress() + ">");
}
/////////////////////////////
// return the from address //
/////////////////////////////
return (party.getAddress());
}
} }