Mirror

How to specify a message subject for an email (Views: 101)


Problem/Question/Abstract:

When I click on a button, I would like to have a message prepared with some information (just a few words). How can I specify this information in the message part or in the subject part of the email?

Answer:

uses
  ShellApi;

procedure TForm1.Button1Click(Sender: TObject);
var
  mail: string;
begin
  mail := 'mailto:you@you.com' + '?subject=hello' + '&cc=me@me.com' + '&body=Delphi is cool! ;)';
  ShellExecute(Self.Handle, 'open', PChar(mail), nil, nil, SW_SHOWNORMAL);
end;

<< Back to main page