if Msg.ContentType = '
text/html'
then
begin
Msg.Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
if AnsiContainsStr(Msg.ContentType, '
text/plain')
then
begin
Msg.Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
if Msg.ContentType = '
multipart/alternative'
then
begin
Msg.Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
if Msg.ContentType = '
multipart/mixed'
then
begin
Msg.Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
if Msg.ContentType = '
multipart/related; type="multipart/alternative"'
then
begin
Msg.Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
if AnsiContainsStr(Msg.ContentType, '
application/pdf')
then
begin
Msg.Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
//Mailteile
for i := 0
to Msg.MessageParts.Count-1
do
begin
erledigt:=0;
if Msg.MessageParts.Items[i]
is tIdAttachment
then
begin
anzahl_anhang:=anzahl_anhang+1;
s := (Msg.MessageParts.Items[i]
as tIdAttachment).Filename;
extensio:= ExtractFileExt(s) ;
(Msg.MessageParts.Items[i]
as tIdAttachment).savetofile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\Anhang_' + neue_nummer +'
_'+inttostr(anzahl_anhang)+extensio);
MAILDATENBANK.Edit;
MAILDATENBANK.FieldByName('
ANHANG_ANZAHL').AsInteger:=anzahl_anhang;
MAILDATENBANK.Post;
Z_NUMMER.SQL.Clear;
Z_NUMMER.SQL.add('
SELECT GEN_ID( POOL, 1 ) AS IDR FROM RDB$DATABASE');
Z_NUMMER.open;
MAILANHANG.Append;
MAILANHANG.FieldByName('
INR').AsInteger:=Z_NUMMER.FieldByName('
IDR').AsInteger;
MAILANHANG.FieldByName('
PR').AsString:=neue_nummer;
MAILANHANG.FieldByName('
ORIGINALNAME').AsString:= (Msg.MessageParts.Items[i]
as tIdAttachment).FileName;
MAILANHANG.FieldByName('
FILE').AsString:= '
Anhang_' + neue_nummer +'
_'+inttostr(anzahl_anhang)+extensio;
MAILANHANG.Post;
end;
if Msg.MessageParts.Items[i]
is TIdText
then
begin
TIdText(Msg.MessageParts.Items[i]).Body.SaveToFile(filename +'
files\Mails\'+inttostr(zaehler1)+'
\'+inttostr(neue_nummer_integer)+'
\html_' + neue_nummer + '
.html',TEncoding.UTF8);
end;
end;
// for i := 0 to Msg.MessageParts.Count-1 do
end;
// Die Mail habe ich noch nicht