When we create a dynamic mail template,then we need to replace the dynamic value with desired key value pair.
Using the following method we can do that.
let mail=` <html> <body> <h1>Welcome, $username!</h1> <h1>Welcome, $address!</h1> <p>Thank you for signing up. We're glad to have you on board.</p> </body> </html> ` const info={ username:"Chandra", address:"Saket Nagar" } for(let rinfo in info){ console.log(rinfo,info[rinfo]) mail=mail.replace('$'+rinfo,info[rinfo]) }
Top comments (0)