Hi, I am trying to send 2 emails from a single service method. This method is called from one of our websites. It seems to work really well but on some occasions (1 out of every 10 emails sent) one or both of the emails will not be sent. Also, sometimes the var data like CustomerCode value gets changed so it is the same in both emails.
Can some see what I might be missing here or can this be done on the server-side?
Thank you!
var Subject: string;
Subject := 'Comment added to '+ ProdProjRefNo +' by the customer';
var Body: string;
Body := 'Dear '+ OurProdProjRefName + ',' + #13#10 + #13#10 +
CustomerContactName + ' (' + PersonCode + '), from ' +
CustomerName + ' (' + CustomerCode + '), has added a comment to ' +
ProdProjRefNo + ' via Company.' + #13#10 + #13#10 +
'Comment: ' + #13#10 + Comment + #13#10 + #13#10 + 'Regards' + #13#10 + 'System';
var SendEmail1: ITask := TTask.Create(
procedure
begin
commonUtility.SendEmailNotification(dbaSystem_UC, OurProdProjRefKey, OurProdProjRefName,
'', Subject, Body);
end
);
Subject := 'Comment added to '+ ProdProjRefNo +' by the customer';
Body := '';
Body := 'Dear '+ OurProdContactName + ',' + #13#10 + #13#10 +
CustomerContactName + ' (' + PersonCode + '), from ' +
CustomerName + ' (' + CustomerCode + '), has added a comment to ' +
ProdProjRefNo + ' via Company.' + #13#10 + #13#10 +
'Comment: ' + #13#10 + Comment + #13#10 + #13#10 + 'Regards' + #13#10 + 'System';
var SendEmail2: ITask := TTask.Create(
procedure
begin
commonUtility.SendEmailNotification(dbaSystem_UC, OurProdContactKey, OurProdContactName,
'', Subject, Body);
end
);
SendEmail1.Start;
SendEmail2.Start;