About the author
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;
A method pointer is now the same as a global procedure, ie, procedure of object = procedure.