Using Outlook email template and Replacing specific lines

Hi,

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.

Thanks in advance!

1 Like

Hi @JDale,

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)

2 Likes

Hi, @shubham.

I’ll have to try this. Should I still use the html format for this?

1 Like

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.

2 Likes

Thanks! Will execute this as discussed :slight_smile:

2 Likes