Wysyłanie maili Indy 10

0

Szukałem na forum odnośnie wysyłania maili w Indy 10 i autoryzacji SSL i doszedłem do czegośtakiego

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase,
  IdSMTP, IdAntiFreezeBase, IdAntiFreeze, IdSASL, IdSASLUserPass, IdSASLLogin,
  IdUserPassProvider;

type
  TForm1 = class(TForm)
    IdSMTP1: TIdSMTP;
    IdMessage1: TIdMessage;
    t: TButton;
    IdAntiFreeze1: TIdAntiFreeze;
    IdSASLLogin1: TIdSASLLogin;
    IdUserPassProvider1: TIdUserPassProvider;
    procedure tClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.tClick(Sender: TObject);
var
IdMessage1: TIdMessage;
IdSASLLogin1: TIdSASLLogin; 
IdSMTP1: TIdSMTP;
LHlogin: TIdUserPassProvider;
result: integer;
begin
result:=0;
idMessage1:=TIdMessage.Create(); 
IdSASLLogin1:=TIdSASLLogin.Create();
IdSMTP1:=TIdSMTP.Create(); 
LHlogin:=TIdUserPassProvider.Create();
idMessage1.ContentType:='text/html';
idMessage1.From.Address:='[email protected]';
idMessage1.Body.Append('TREŚĆ MAILA');
IdMessage1.Recipients.EMailAddresses := '[email protected]';
IdMessage1.Subject := 'TEMAT';

with IDSMTP1 do
begin
Host:='smtp.gmail.com ';
port:=587;
username:='login';
password:='haslo';
LHlogin.Username:='login';
LHlogin.Password:='haslo';
IDSMTP1.AuthType:=atSASL;
IDSMTP1.SASLMechanisms.Add.SASL:=IdSASLLogin1;
IdSASLLogin1.UserPassProvider:=LHlogin;
try
idsmtp1.Connect;
<b>idsmtp1.Authenticate;   // ----> tu wywala błąd</b>
idsmtp1.Send(idMessage1);
idsmtp1.Disconnect;
result:=1;
finally
end;
end;
idMessage1.Free;
IdSASLLogin1.Free;
IdSMTP1.Free;
LHlogin.Free;
end;

end.

Kompilaccje przebiega pomyslnie natomiast podczas próby wysłania Dellphi woła
Project Project1.exe raised exception class EidSocketError with message SocketError # 11001 Host not found

Jestem słaby z Dellphi więc proszę o pomoc.

0

z tym problemem sobie poradziłem jest nowy

Project Project1.exe raised exception class EidSMTPReplyError with message Must ISSUE a STARTTLS command first<code>

0

http://groups.google.com/group/pl.comp.lang.delphi/browse_thread/thread/61846fce68087813#

Odpowiedź 13 od góry

Twojego przykładu nie analizowałem ... i nie zamierzam : )

1 użytkowników online, w tym zalogowanych: 0, gości: 1