unit mailer;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, IdMessage, IdBaseComponent, IdComponent,
  IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP;

type
  TForm1 = class(TForm)
    smtp: TIdSMTP;
    Message: TIdMessage;
    StatusBar1: TStatusBar;
    Button1: TButton;
    GroupBox1: TGroupBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
    procedure smtpStatus(ASender: TObject; const AStatus: TIdStatus;
      const AStatusText: String);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
message.receiptrecipient.address := edit2.Text;
message.Body.assign(memo1.Lines);
message.subject := edit1.Text;
smtp.connect(5000);
smtp.sendmsg(message, true);
smtp.disconnect;
end;

procedure TForm1.smtpStatus(ASender: TObject; const AStatus: TIdStatus;
  const AStatusText: String);
begin
statusbar1.SimpleText :=astatustext;
end;

end.
