The client requirement is to customize the dunning email templates for each level in the account. In the dunning module, according to the due date mentioning the email templates can be set for each level. The level here means the due date of the Invoice for each customer like if it is due for less than 0 days, if it is due for 5 days, due date is between 5 and 12 days, and the above.
We have created 4 email templates with different subjects and content in the account. The email templates can be created by navigating to Documents–> Templates –> Email Templates –> new
Level 1 Dunning email template
Subject:- Your Payment is Due Soon

Dear <b>${customer.companyname}</b>,<br />
<p>This is a courtesy reminder that your payment is due soon. For your convenience, we have included the invoice information below.</p>
<span> <#if invoicelist?has_content> </span>
<table border="1" style="font-family: sans-serif; font-size: 12px">
<tbody>
<tr>
<td><span>Invoice #</span></td>
<td><span>Invoice Date</span></td>
<td><span>Due Date</span></td>
<td><span>Amount </span></td>
</tr>
<#list invoicelist as invoice>
<tr>
<td><span>${invoice.tranid}<#if invoice.custbody_3805_dunning_procedure != "">*</#if></span></td>
<td><span>${invoice.trandate}</span></td>
<td><span>${invoice.duedate}</span></td>
<td><span>${invoice.fxamountremaining?string.number}</span></td>
</tr>
</#list>
</tbody>
</table>
<span> <#elseif invoice??> <!-- for invoice dunning --> </span>
<table border="1" style="font-family: sans-serif; font-size: 12px">
<tbody>
<tr>
<td><span>Invoice #</span></td>
<td><span>Description</span></td>
<td><span>Invoice Date</span></td>
<td><span>Due Date</span></td>
<td><span>Currency</span></td>
<td><span>Amount</span></td>
</tr>
<tr>
<td><span>${invoice.tranid}</span></td>
<td><span>${invoice.memo}</span></td>
<td><span>${invoice.trandate}</span></td>
<td><span>${invoice.duedate}</span></td>
<td><span>${invoice.currency}</span></td>
<td><span>${invoice.amountremaining}</span></td>
</tr>
</tbody>
</table>
<span> </#if> </span>
<p>You may send the payment via check or pay directly through our online payment portal.<br />
<a href="${customer.custentity_stripe_customer_account_link}">Pay Now</a><br />
If you have any questions regarding your payment, please don’t hesitate to reach out.<br />
</p>
<p>Thank you,<br />
${customer.custentity_cedar_credit_analyst}<br />
Cedar Electronics Corporation.</p>
Level 2 Dunning Template
Subject :- ACTION REQUIRED: Your Account is Past Due

Level 3 Dunning Template
Subject :- ACTION REQUIRED: Your Account is Past Due

Level 4 Dunning Template
Subject :- URGENT: Your Account is on Hold

The above code can be reused for all the four levels of Email templates. Only the subject and contents are changing.