I want to use an email template for sending emails but I need to replace the details in the body depending on the database. Kindly check the sample email below.
Dear (Client Name),
Good Day.
We like to request some items for this coming weekend. These items must be delivered to our warehouse not later than (deadline - Date and Time). The early receipt of the items will give us ample time to distribute said items to our branches spread all over the country.
As I understand you will be storing this body template in string variable and will be fetching data for Client name and deadline - Date and Time from database.
So you can use .replace function of String to update the body based on DB input.
Something like below you can use,
body.replace(“(Client Name)”, clientNameFromDatabase).replace(“(deadline - Date and Time)”, valueFromDatabase)
Nope… I dont think html format will be required here, as we are not using any html tags. The input string is already constant and we are just using replace function. So won’t be needed.