title: Sending Email in delphi
body: <p>my problem is this: i try to send an email with delphi 7, but when i try to send it, I get an error.</p>
  
  <p>Maybe is only a problem about TIdSMTP, that it can't connect with a smtps server, but i didn't found another component for send mail with delphi 7. </p>
  
  <p>My code is this one:</p>
  
  <pre><code>unit Unit1;
  
  interface
  
  uses
    inifiles, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
    IdTCPClient, IdMessageClient, IdSMTP, DB, DBTables, ExtCtrls,
    ComCtrls, StdCtrls, Buttons;
  
  type
    TForm1 = class(TForm)
      Button1: TButton;
      MailMessage: TIdMessage;
      SMTPS: TIdSMTP;
      AttachmentDialog: TOpenDialog;
      Body: TMemo;
      StatusMemo: TMemo;
      Timer1: TTimer;
  
      procedure Button1Click(Sender: TObject);
    private
  
    public
      Host : string;
      Port : string;
      Username : string;
      Password : string;
    end;
  
  var
    Form1: TForm1;
  
  implementation
  
  {$R *.dfm}
  procedure TForm1.Button1Click(Sender: TObject);
  var
  Host, Username, Password : string;
  begin
  
     Host     := 'smtps.aruba.it'; //Aruba SMTPS Host
     Username := 'xxxx@xxxxxxx.xxx';
     Password := 'yyyyyyyy';
  
    //setup SMTP
    SMTPS.Host := Host;
    SMTPS.Port := 465;//SMTPS Port of Aruba
    SMTPS.Username := Username;
    SMTPS.Password := Password;
  
    //setup mail message
    MailMessage.From.Address := 'xxxxx@xxxxxxxx.xxx';
  
    MailMessage.Subject := 'Subject';
    MailMessage.Body.Text := 'Body Text';
  
    //send mail
    try
      try
        SMTPS.Connect(1000);
        SMTPS.Send(MailMessage);
      except on E:Exception do
        showmessage(E.message);
      end;
    finally
      if SMTPS.Connected then SMTPS.Disconnect;
    end;
  
  end;
  
  end.
  
  </code></pre>
  
  <p>The error is this:</p>
  
  <p><strong>Connection Closed Gracefully</strong></p>