procedure TUniServerModule.UniThreadTimer1Timer(Sender: TObject);
// UniMainModule
var MailCount,Mailgroesse,intIndex :Integer;
itm:TListItem;
i:integer;
s:
string;
begin
POP.Host := '
pop.1und1.de';
POP.Port := 995;
POP.Username := '
xxxxxx';
POP.Password := '
yyyyyyy';
POP.Connect;
Logger.AddLog('
.. erzeuge Verbindung zum POP Server....');
MailCount := POP.CheckMessages;
if MailCount = 0
then Logger.AddLog('
Keine neuen Mails vorhanden...');
if MailCount >0
then
begin
for intIndex := 1
to MailCount
do
begin
msg.Clear;
pop.Retrieve(intIndex, Msg);
Logger.AddLog('
MIMEBoundary: '+inttostr(msg.MIMEBoundary.Count));
if msg.IsMsgSinglePartMime
then Logger.AddLog('
IsMsgSinglePartMime');
if msg.IsEncoded
then Logger.AddLog('
IsEncoded');
if msg.IsMsgSinglePartMime
then Logger.AddLog('
IsMsgSinglePartMime');
if msg.NoEncode
then Logger.AddLog('
NoEncode');
Logger.AddLog('
------------------------------------------');
//Anhang
for i := 0
to Msg.MessageParts.Count-1
do begin
if Msg.MessageParts.Items[i]
is tIdAttachment
then
begin
s := (Msg.MessageParts.Items[i]
as tIdAttachment).Filename;
Logger.AddLog('
Anhang: '+s);
(Msg.MessageParts.Items[i]
as tIdAttachment).savetofile(uniservermodule.FilesFolderPath +'
Mails\Anhang_' + IntToStr(intIndex) +s);
end;
end;
// HTML Mail
if msg.MessageParts.Count > 0
then
begin
Logger.AddLog('
HTML-Mail:');
for i := 0
to Msg.MessageParts.Count-1
do begin
if Msg.MessageParts.Items[i]
is TIdText
then
begin
//Logger.AddLogStrings(TIdText(Msg.MessageParts.Items[i]).Body);
TIdText(Msg.MessageParts.Items[i]).Body.SaveToFile(uniservermodule.FilesFolderPath +'
Mails\html_' + IntToStr(intIndex) + '
.html');
end;
end;
end;
// Text Mail
if msg.ContentType = '
text/plain'
then
begin
Logger.AddLog('
TXT-Mail:');
//Logger.AddLogStrings(msg.body);
Msg.Body.SaveToFile(uniservermodule.FilesFolderPath +'
Mails\text_' + IntToStr(intIndex) + '
.txt');
end;
pop.Delete(intIndex);
// Löscht die aktuelle Mail !!!!
end;
end;
POP.Disconnect;
end;