Ian Branch 128 Posted November 15, 2022 (edited) Hi Team, I thought I would try refactoring some code that is used 5 times in the Unit. Seemed a good idea. Win 11, D11.2, EurekaLog. I have the following as a private function for the form.. 'There is no Corporate Email Address recorded in the Company data!' In the calling code I have.. // var MailSender := TELMailSMTPClientSender.Create; // try // MailSender.Options := CurrentEurekaLogOptions; // MailSender := SetSvcOrCorpSender(MailSender); // And the refactored code is.. function TJobTicketsForm.SetSvcOrCorpSender(var MailSender: TELMailSMTPBaseSender): TELMailSMTPBaseSender; begin // // Set Sender while True do begin // case tdSvcorCorpSend.Execute of 100: begin if Trim(ACD.ServiceEmail) = '' then begin Showmessage('There is no Service Email Address recorded in the Company data!'); Continue; end; // MailSender.Options.SendSMTPClientFrom := Trim(ACD.ServiceEmail); if Trim(ACD.ServiceEmailName) = '' then MailSender.Options.OverrideUserFullName := StrTokenAt(Trim(ACD.ServiceEmail), '@', 1) else MailSender.Options.OverrideUserFullName := Trim(ACD.ServiceEmailName); Break; end; 200: begin if Trim(ACD.CorporateEmail) = '' then begin Showmessage('There is no Corporate Email Address recorded in the Company data!'); Continue; end; // MailSender.Options.SendSMTPClientFrom := Trim(ACD.CorporateEmail); break; end; end; // end; //; Result := MailSender; // end; Trouble is that delphi tells me that the types and formal var parameters must be identical. Ummm. Arent they? Resolved. IT seems I missed a step during my In-Line variables conversion.. // var MailSender: TELMailSMTPBaseSender; // <<<<<<<<<<<<<<<<<<<<<<< // MailSender := TELMailSMTPClientSender.Create; // Regards & TIA, Ian Edited November 15, 2022 by Ian Branch Share this post Link to post