More coding again today.
Today, I wrote a demo that demonstrates how to send email using hMailServer.After importing the TLB (hMailServer.tlb) from C:\Program Files\hMailServer\Bin and adding the created unit to a new VCL project, and to a new form, I dropped a button on the new form, double clicked on the button, and wrote the following code for the button click's event.
procedure TForm1.Button1Click(Sender: TObject);var LMessage: TMessage; LBody: string;begin LMessage := TMessage.Create(nil); try LMessage.From := 'Me <myemailaddress@mydomain.com>'; LMessage.Subject := 'Hi!!'; LMessage.AddRecipient('A Recipient', 'someone@somewhere.com'); LBody := Format('This is the contents of the demo email for hMailServer project. - %s', [ FormatDateTime('dd mmm yyyy - hh:nn:ss', Now)]); LMessage.Body := LBody; LMessage.Save; finally LMessage.Free; end;end;
In 2017, with the release of Delphi 10.2 Tokyo, Embarcadero introduced a specialized implementation of the Observer pattern into the System.Classes unit. While it has been in the wild for 9 years, it remains a "hidden" architecture for many, primarily because it serves as the invisible engine behind LiveBindings. Other than live bindings, you can also use the Observer pattern as a way to update component settings to the Windows registry, an .ini file, or persist it elsewhere.
System.Classes