witam
zastanawiam sie czemu nie dziala?. dzisiaj rano uruchomilem program i wyslal a pozniej i do tej pory juz nie wysyla. przeszukalem cale forum i nic ??????
procedure TForm1.Button2Click(Sender: TObject);
begin
IdMessage1.Clear;
IdMessage1.Body.Append('to jest email alarmowy'); //trasc maila
IdMessage1.Recipients.EMailAddresses := '[email protected]';
IdMessage1.Subject := 'Uwaga';
idMessage1.From.Address := '[email protected]'; //od kogo email wyslany
IdSMTP1.Password := 'hasło';
IdSMTP1.Username := 'cichy-kuba';
IdSMTP1.Host := 'poczta.o2.pl';
IdSMTP1.AuthenticationType:=atLogin;
//TIdAttachment.Create(IdMessage1.MessageParts, 'SCIEŻKA DO PLIKU KTÓRY MA BYĆ W ZAŁĄCZNIKU');
if not IdSMTP1.Connected then
begin
try
StatusBar1.SimpleText := 'Zestawianie połączenia z serwerem ...';
//nawiązywanie połączenia
IdSMTP1.Connect(-1);
StatusBar1.SimpleText := 'Połączony ...';
except
on exception do
begin
StatusBar1.SimpleText :='BŁĄD !!! Wysyłanie poczty !!! Polączenie z serwerem '
+ IdSMTP1.Host + ' niepowiodło się !!!';
IdMessage1.Clear; //czyszczenie wiadomosci
end;
end;
if IdSMTP1.Connected then
begin
StatusBar1.SimpleText := 'połaczony';
try
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
StatusBar1.SimpleText := 'wiadomość e-mail została wysłana na adres:'+idMessage1.From.Address;
end;
end;
end;
end;