implementation
{$R *.dfm}
function tform1.SendEmail(Recipient:
string;CCList:
string;sSubject:
string;Body:TStringList):boolean;
var
nAlarmnr:integer;
begin
idSMTP.Host := server.text;
idSMTP.Port := 25;
idMessage.From.text := absender.text;
idMessage.Sender.text:=idMessage.From.text;
idMessage.Recipients.EMailAddresses:= Recipient;
idMessage.CCList.EMailAddresses := CCList;
idMessage.Subject:=sSubject;
idMessage.Body.Clear;
idMessage.Body := Body;
try
idSMTP.Connect;
idSMTP.Send(idMessage);
idSMTP.Disconnect;
result:=True;
except on E :
Exception do
begin
if idSMTP.connected
then try idSMTP.disconnect;
except end;
result := false;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Text.Clear;
end;
procedure TForm1.Beenden1Click(Sender: TObject);
begin
Close;
end;
procedure TForm1.Serverlisteabrufen1Click(Sender: TObject);
begin
URLDownloadToFIle(
nil,'
http://web***.*****.de/server.txt', '
server.txt',0,
nil);
Server.Items.LoadFromFile('
server.txt');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
if fileexists('
server.txt')
then deletefile('
server.txt');
end;
procedure TForm1.HauwegdenDreck1Click(Sender: TObject);
var
st: TStringList;
begin
st := TStringList.Create;
st.Text := text.Lines.Text;
form1.SendEmail(empfaenger.Text, '
', betreff.Text, st);
st.Free;
end;