Search code examples
sap-commerce-cloud

How to set to email from project.properties files


I need to trigger two emails for my application, one to logged-in user and one to customer-care. For the customer care, I am setting the email id in project.properties and then hitting the event class:

deleteAccountSupportEvent.setAgentEmail(agentEmailAddress);

agentEmailAddress is picking email id from project.properties: final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);

I have set the email in Context class as well : setAgentEmail(((PHDeleteAccountEmailProcessModel) processModel).getAgentEmail());

But instead of all this, mail is getting triggered to logged-in user. Please help.


Solution

  • You can keep it simple as follows:

    final String agentEmailAddress = getConfigurationService().getConfiguration().getString(DELETE_REQUEST_EMAIL_TO_AGENT);
    
    setAgentEmail(agentEmailAddress);