Mention below are the codes to sent mail to customer
when I replace Percentile value of html template with field then it cant replace can you place check my code where i write wrong code
TemplatesTable.SETRANGE(Code,'141');
IF TemplatesTable.FINDSET THEN BEGIN
TemplatesTable.CALCFIELDS(ImportTemp);
IF NOT TemplatesTable.ImportTemp.HASVALUE THEN
ERROR('Not Found');
TemplatesTable.ImportTemp.CREATEINSTREAM(Ins);
StreamReader:=StreamReader.StreamReader(Ins);
EmailTemplateBody:=StreamReader.ReadToEnd();
StreamReader.Close();
Customer.GET(CustNo);
NotificationBodyString:=NotificationBodyString.Copy(EmailTemplateBody);
NotificationBodyString := NotificationBodyString.Replace('%CompanyName%',SoftwareNameTxt);
TextTable:=NotificationBodyString.ToString;
TextTable:=STRSUBSTNO(TextTable,'%CustomerName%',Customer.Name);
TextTable:=STRSUBSTNO(TextTable,'%CustomerAddress%',Customer.Address);
TextTable:=STRSUBSTNO(TextTable,'%ContactN%',Customer.Contact);
TextTable:=STRSUBSTNO(TextTable,'%Email%',Customer./E-Mail/);
TextTable:=STRSUBSTNO(TextTable,'%Home%','<a href=https:/https://www.flipkart.com//>Home</a>');
TextTable:=STRSUBSTNO(TextTable,'%About%','<a href=https:/https://www.facebook.com/flipkart//>About</a>');
TextTable:=STRSUBSTNO(TextTable,'%ContactUs%','<a href=https://www.flipkart.com/helpcentre//>Contact Us</a>');
SMTPSetup.GET();
SMTPMail.CreateMessage('',SMTPSetup./User ID/,Customer./E-Mail/,'Test1','',TRUE);
Customer.RESET;
Customer.CALCFIELDS(/Balance (LCY)/);
Customer.SETFILTER(Balance,'>%1',0);
IF Customer.FINDSET THEN BEGIN
Customer.TESTFIELD(/E-Mail/);
SMTPMail.AddCC(Customer./E-Mail/);
SMTPMail.AppendBody(TextTable);
SMTPMail.Send;
END;
END;