Autor Beitrag
Karstadt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 174

Windows 2000 / XP
Delphi 7 Pro
BeitragVerfasst: Do 20.10.05 16:11 
Hallo.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
If idPOP31.CheckMessages = 0 Then
  begin
    l_nachrichtenanzahl.Caption := ' 0 Nachrichten';
    close;
  end;
  l_nachrichtenanzahl.Caption:=inttostr(idPOP31.CheckMessages+1)+' Nachrichten';

  for i:=1 to idPOP31.CheckMessages do
  begin
  idPOP31.Retrieve(i, IdMessage1);

    for intIndex := 0 to Pred(IdMessage1.MessageParts.Count) do begin
    if (IdMessage1.MessageParts.Items[intIndex] is TIdAttachment) then
    begin
      m_log.lines.add(TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).Filename);
      Application.ProcessMessages;
  end;
  end;

wie kann ich Betreff aus eine E-mail auslesen?

MFG

Moderiert von user profile iconAXMD: Delphi-Tags hinzugefügt.
Raffo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 300



BeitragVerfasst: Do 20.10.05 20:48 
zuerst der Header von der POP Kompo geholt und dieser geht in die IdMessage1 rein, diese dann abfragen (hier String "s")

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var i:integer;
var s:string;

...

idPOP31.RetrieveHeader(i,IdMessage1);
s:=IdMessage1.Subject;
Karstadt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 174

Windows 2000 / XP
Delphi 7 Pro
BeitragVerfasst: Fr 21.10.05 09:27 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
for i:=1 to idPOP31.CheckMessages do
  begin
    idPOP31.Retrieve(i, IdMessage1);
    Showmessage(IdMessage1.Subject);

    for intIndex := 0 to Pred(IdMessage1.MessageParts.Count) do
    begin
      if (IdMessage1.MessageParts.Items[intIndex] is TIdAttachment) then
      begin
        m_log.lines.add(TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).Filename);
        Application.ProcessMessages;
      end;
    end;
  end;


Das funktioniert nicht. Jedesmal bekomme ich das selbe Betreff. Was mache ich falsch?

MFG

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
Raffo
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 300



BeitragVerfasst: Fr 21.10.05 09:34 
So sehr habe ich auch noch nicht damit gearbeitet, aber in meinem Code funzt das, wenn ich

idPOP31.RetrieveHeader(i,IdMessage1);

verwende. Also so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
for i:=1 to idPOP31.CheckMessages do 
begin 
idPOP31.Retrieve(i, IdMessage1); 
idPOP31.RetrieveHeader(i,IdMessage1); //vielleicht doppelt gemoppelt?
Showmessage(IdMessage1.Subject);
Karstadt Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 174

Windows 2000 / XP
Delphi 7 Pro
BeitragVerfasst: Fr 21.10.05 10:55 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
for i:=1 to idPOP31.CheckMessages do
  begin
   idPOP31.Retrieve(i, IdMessage1);
   //idPOP31.RetrieveHeader(i,IdMessage1); //vielleicht doppelt gemoppelt?
   Showmessage(IdMessage1.Subject +' Zahl '+FloatToStr(i));

    for intIndex := 0 to Pred(IdMessage1.MessageParts.Count) do
    begin
      if (IdMessage1.MessageParts.Items[intIndex] is TIdAttachment) then
      begin
        m_log.lines.add(TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).Filename);
        //TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).SaveToFile(Speicherort+TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).Filename);
        Application.ProcessMessages;
      end;
    end;
  IdMessage1.Clear;
  //idpop31.Delete(i);
  end;


Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.