Mention below are the code to sent mail i stuck in this code can you please help me to stuck out
Documentation()
OnRun()
SentMailWithTemplate('');
SentMailWithTemplate(CustNo : Code[20])
SMTPSetup.GET;
Customer.RESET;
Customer.CALCFIELDS("Balance (LCY)");
Customer.SETFILTER(Balance,'>%1',0);
IF Customer.FINDSET THEN
Customer.CALCFIELDS("Balance (LCY)");
TemplatesTable.CALCFIELDS(ImportTemp);
IF TemplatesTable.GET('141')THEN
IF Rec.ImportTemp.HASVALUE THEN
CLEAR(Rec.ImportTemp);
Rec.ImportTemp.CREATEINSTREAM(Ins);
StreamReader:=StreamReader.StreamReader(Ins);
EmailTemplateBody:=StreamReader.ReadToEnd();
StreamReader.Close();
NotificationBodyString:=NotificationBodyString.Copy(EmailTemplateBody);
NotificationBodyString := NotificationBodyString.Replace('%SoftwareName%',SoftwareNameTxt);
TextTable:=NotificationBodyString.ToString;
SMTPMail.CreateMessage('',SMTPSetup."User ID",Customer."E-Mail",'Test1','',TRUE);
IF Customer."E-Mail"<>'' THEN
SMTPMail.AddCC(Customer."E-Mail");
SMTPMail.AppendBody(TextTable);
SMTPMail.Send;