Autor Beitrag
areuter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: So 27.03.05 15:51 
frohe ostern!
ich habe eine kleine frage:
was mache hier falsch?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
nmpop31.Connect;
mailcount:=nmpop31.MailCount;
for i:=1 to mailcount do
begin
nmpop31.GetMailMessage(i);
if nmpop31.MailMessage.Subject='XXX' then showmessage('stimmt');
end;
nmpop31.Disconnect;


wenn ich mir eine email mit dem betreff XXX schicke und mit label1.Caption:=nmpop31.MailMessage.Subject mir diese anzeigen lasse, dann sehe ich den betreff. aber mit if... then funkt. es leider nicht??? warum auch immer?
vielen dank im voraus!
grüsse
arne
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: So 27.03.05 15:59 
Geht das:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
...
  nmpop31.Connect;  
  mailcount := nmpop31.MailCount;  
  for i := mailcount downto 1 do  
  begin  
    nmpop31.GetMailMessage(i);  
    if nmpop31.MailMessage.Subject = 'XXX' then 
      Showmessage('stimmt');  
  end;  
  nmpop31.Disconnect; 
...
areuter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: So 27.03.05 16:05 
schönen dank für die schnelle antwort!
nein leider auch nicht.
ich hatte es schon mit
ausblenden Delphi-Quelltext
1:
2:
label1.caption:=nmpop31.MailMessage.Subject;
if label1.caption='XXX' then showmessage('stimmt');

versucht. funktioniert leider auch nicht?
gruss
arne
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: So 27.03.05 16:12 
Lass dir mal den Text als Hex-Code anzeigen, evt. sind da noch CR,LF oder sowas angehängt!
areuter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: So 27.03.05 19:59 
...aber das macht doch eigentlich keinen sinn oder?
wenn ich einem label1 (z.b.) den wert des MailMessage.Subject zuordne und diesen dann später mit einem if label1=label2 (z.b.) auslese, dann übernimmt der rechner doch keinen anderen wert oder...?
gruss
arne
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: So 27.03.05 22:35 
Tja Arne,

aber irgendwas ergibt bei deinem Vergleich FALSE! (CR,CRLF,LF,Unicode,Uppercase,Lowercase,Trim usw. ?)
areuter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: So 27.03.05 23:45 
hallo wdbee!
...nur was ;-)
danke aber für deine mühe!
ich verstehe das aber trotzdem noch nicht. dann müsste doch ein wert (wie z.b. die zahl '1' einen anderen wert als '1' annehmen!? ich heisse zwar nicht spok aber soweit kann ich noch logisch denken, glaube ich zumindest ;-)
angenehme nacht ruhe.
arne
areuter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: Mo 28.03.05 11:08 
...mit den indy komp. geht es!

ausblenden Delphi-Quelltext
1:
if idmessage1.Subject='XXX' then showmessage('stimmt');					
areuter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: Mo 28.03.05 11:27 
...ich nehme es zurück (sorry! mein fehler) - geht auch nicht.
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mo 28.03.05 11:41 
Aber wo ist das Problem? Lass dir doch mal den Inhalt von nmpop31.MailMessage.Subject so ausgeben, dass du siehst was da wirklich drínsteht!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
var
  aSubject: string;
  I, N: Integer;
  Zeile: string;
begin
  Zeile := '';
  aSubject := nmpop31.MailMessage.Subject;
  N := Length(aSubject); // Anzahl de Zeichen in String
  for I := 1 to N + 1 do
    Zeile := Zeile + '$' + IntToHex(Ord(aSubject[I]),2) + ';';
  ShowMessage(Zeile);
end;
areuter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 75



BeitragVerfasst: Mo 28.03.05 13:20 
hallo
lieben dank!
du hast recht. wenn ich deinen sourcecode bei mir einbaue, bekomme ich z.b. für
XXX $20;$58;$58;$58;$00 es scheint immer eine $20 am anfang und $00 am schluss zu stehen.
also jetzt am besten den betreff in hex aufdröseln und dann die abfrage (if..then..).
vielen dank für die hilfe!
wünsche dir noch einen schönen tag
gruss arne
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Mo 28.03.05 14:17 
Das wäre auch Unfug. Die $00 ist das Stringende und stört nicht, im Gegenteil, die muss da sein.
Aber das Leerzeichen bekommst du mit Trim(DeinString); weg. Schau mal dazu in die Hilfe.