Smtp authentification problem

Giganews Newsgroups
Subject: Smtp authentification problem
Posted by:  Sylvain (sylvain.amy…@sftsa.com)
Date: Thu, 23 Nov 2006

Hi,

I have a problem has to send emails with a server which requires an
authentification.

I installed a tIdUserPassProvider in which I configured my user code and
my password.

I installed a tIdSASLLogin in which I assigned the tIdUserPassProvider

I assigned the tIdSASLLogin has my tIdSmtp in SASLMechanisms

Then i run the procedure btnSendMailClick

And I always have the following message when I makes SMTP.Sent
"Connection Closed Gracefully"

sylvain.amy…@groupevoralis.com

procedure TMailerForm.btnSendMailClick(Sender: TObject);
Var xIoHandler : TIDSSLIOHandlerSocketBase;
    html      : TStrings;
begin
  StatusMemo.Clear;

  xIoHandler := TIDSSLIOHandlerSocketBase.Create;

  Smtp.AuthType  := atSASL;
  Smtp.UseEhlo  := True;
  Smtp.IOHandler := xIoHandler;
  Smtp.UseTLS    := utUseRequireTLS;
  SMTP.Host      := 'smtphm.sympatico.ca';
  SMTP.Port      := 25;

  html := TStringList.Create();
  html.Add('<html>');
  html.Add('<head>');
  html.Add('</head>');
  html.Add('<body><h1>Hello</h1>');
  html.Add('</html>');

  //setup mail message
  MailMessage.From.Address := ledFrom.Text;
  MailMessage.Recipients.EMailAddresses := ledTo.Text + ',' +
ledCC.Text;

  MailMessage.Subject := ledSubject.Text;
  MailMessage.Body.Assign(Html);

  //send mail
  try
    SMTP.Connect;
    try
      SMTP.Send(MailMessage);
    except on E:Exception do
      StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
    end;
  finally
    if SMTP.Connected then SMTP.Disconnect;
  end;
  html.Free;
  xIoHandler.Free;
end;

Replies