Also ich stecke hier fest:
Delphi-Quellcode:
...
type TMailThread = function(mail: TIDMessage; SMTP1: TIDSmTP; Filep: String): Integer;
...
function MailThread(email: TIdMessage; smtp1: TIdSmtp; Filep: String): Integer;
var i: Integer;
begin
for i := 1 to globalcnt -1 do
begin
if FileExists('./temporary/'+ExtractFileName(filep)+'_'+Inttostr(i)) then
TIdAttachment.Create(email.MessageParts, './temporary/'+ExtractFileName(filep)+'_'+Inttostr(i));
EMail.Subject := ExtractFileName(filep)+'_'+Inttostr(i);
smtp1.Connect;
try
smtp1.Send(Email);
smtp1.Disconnect;
finally
eMail.MessageParts.Clear;
end;
end;
end;
...
...
...
procedure TForm1.sndButtonClick(Sender: TObject);
var ThreadID: DWORD;
ThreadHandle: THandle;
begin
ThreadHandle:=CreateThread(nil, 0, TFNThreadStartRoutine(@MailThread),
nil, 0, ThreadID);
if ThreadHandle<>0 then CloseHandle(ThreadHandle);
end;
...
Es könnte sein, dass ich alles falsch gemacht habe, deshalb seit net zu streng