Autor Beitrag
wlfmario
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 114

Windos XP SP2
D7 Enterprise & D2005 PE
BeitragVerfasst: Di 07.03.06 19:43 
Hallo zusammen,

jetzt bin ich über eine Woche am Suchen in nach einer Lösung wie ich meine Mails die im MIME Format anzeigen kann !
Ich lade mir alle Mails per Stream in die IDMessage um sie anzeigen zu lassen.
Dabei wird unterschieden ob es sich um einen Anhang oder um eine Text Nachricht handelt.
Wenn ich jetzt aber eine Mail die einen Anhang und Text beinhaltet auswerten möchte, bekomme ich immer nur die Meldung das es sichum eine Mail im MIME-Format handelt.
Wie komme ich jetzt an die Nachricht in der Mail ?
Wo liegt der Fehler ?
Ich habe schon im Forum gesucht und Google belästigt aber irgendwie finde ich den Feler nicht.
Ich hoffe, es kann jemand helfen.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
procedure THauptForm.ListView1SelectItem(Sender: TObject; Item: TListItem;
  Selected: Boolean);
var
  i, AttachCount: integer;
  Attach: string;
  MailPfadDaten: TMailPfadDaten;
  MailLoadStream: TFileStream;
begin
  AttachCount := 0;
  i := 0;
  for I := 0 to Listview1.Items.Count - 1 do
  begin
    if ListView1.Items[I].Selected then
    begin
      RichEdit1.Clear;
      ListView2.Clear;
      MailPfadDaten := TMailPfadDaten(ListView1.Items[I].data);
      MailLoadStream := TFileStream.Create(ExtractFilePath(Application.ExeName)
        +
        '/Mail-In/' + MailPfadDaten.Mailpfad, fmOpenRead or fmShareExclusive);
      Msg.Clear;
      Msg.LoadFromStream(MailLoadStream, false);
      if pos('multipart/mixed', msg.ContentType) = 1 then
      begin
        for AttachCount := 0 to pred(Msg.MessageParts.Count) do
        begin
          if Msg.MessageParts.Items[AttachCount] is TIDAttachment then
            ListView2.Items.Add.Caption := (Msg.MessageParts.Items[AttachCount]
              as
              TIDAttachment).FileName
          else if Msg.MessageParts.Items[AttachCount] is TIDText then
            Attach := (Msg.MessageParts.Items[AttachCount] as
              TIDText).Body.Text;
        end;
      end
      else
        Attach := Msg.Body.Text;
    end;
  end;
  RichEdit1.Text := Attach;
  MailLoadStream.Free;
end;