Bonjour a tous,
j'ai un souci pour lire mes message mail en delphi7.
Je peux le lire, je retrouve aussi les piece jointe.
Mais, dans certains message, il y a des images embedded, cad directement dans le corps du message. Hors, j'ai une croix rouge a la place de l'image,
et quand je fais afficher l'image, rien ne se passe.
Comment puis je faire pour intégrer ces images directement ?
Là je sèche complètement.
Mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
procedure TFrmMessagerie2.LireMessage;
Var
  i ,j : integer;
  lIndexRec, lindexCol : Integer;
  AImage : TImage;
begin
 
  ForceDirectories(FDirSave);
  // On se connecte au compte mail si ce n'est pas déjà fait
  if not POP3.connected then
    POP3.connect;
 
  ViewAttach.BeginUpdate;
  while (ViewAttach.DataController.RecordCount>0) do  // On supprime tout
    ViewAttach.DataController.DeleteRecord(0);
 
  EmbeddedWB.LoadFromString('');
 
 
  lindexCol:=ViewAttach.ViewData.GridView.FindItemByName('VColAttach').Index;
 
  // On va boucler du premier au dernier message sur le compte
//  for i := 1 to POP3.CheckMessages do
//  i := lstMsgs.ItemIndex+1;
  i := ViewListeMess.Controller.FocusedRowIndex+1;
 
  begin
    // On récupère le message complet
    idMsg.Clear;
    POP3.Retrieve(i,idMsg);
    FromText.Caption := idMsg.From.Address;
    ToText.Caption := idMsg.Recipients.EMailAddresses;
    try
      CCText.Caption := idMsg.CCList.Items[0].Text;
    except
    end;
    SubjectText.Caption := idMsg.Subject;
    SenderText.Caption := idMsg.From.Name;
    OrganisationText.Caption := idMsg.Organization;
    DateText.Caption := DateToStr(idMsg.date);
 
      // (mpHighest, mpHigh, mpNormal, mpLow, mpLowest);
    If idMsg.Priority = mpHighest then
      PriorityText.Caption := 'Tres haut'
    else If idMsg.Priority = mpHigh then
      PriorityText.Caption := 'Haut'
    else If idMsg.Priority = mpNormal then
      PriorityText.Caption := 'Normal'
    else If idMsg.Priority = mpLow then
      PriorityText.Caption := 'Bas'
    else If idMsg.Priority = mpLowest then
      PriorityText.Caption := 'Très bas';
 
    // Si on a plusieurs parties dans le mail alors on a une pièce jointe
    if idMsg.MessageParts.Count > 0 then
    begin
 
      for j := 0 to idMsg.MessageParts.count -1 do
    //   j := 0;
      begin
        // Est-ce une partie texte du mail ?
        if idMsg.MessageParts.Items[j] is TIdText then
        With TIdText(idMsg.MessageParts.Items[j]) do
        begin
 
           // Load the string
           EmbeddedWB.LoadFromWideString(TIdText(idMsg.MessageParts.Items[j]).Body.text);
 
           // C'est ici que l'image devrait se loader !
 
 
        end;
 
        // Est-ce une pièce jointe ?
        if idMsg.MessageParts.Items[j] is TidAttachment then
          With TIdAttachment(idMsg.MessageParts.Items[j]) do
          begin
 
            if FileExists(FDirSave + FileName) then
               DeleteFile(FDirSave + FileName);
 
                // On sauvegarde le fichier
            SaveTofile(FDirSave + Filename);
 
 
            If Pos('attachment',ContentDisposition)>0 then
            begin
              lIndexRec:=ViewAttach.DataController.AppendRecord;
              ViewAttach.DataController.SetValue(lIndexRec,lindexCol,Filename);
            end
            else // on a une image dans le browser
            begin
           //   ShowMessage(idMsg.MessageParts.Items[j].Headers.Text);
 
            end;
 
          end;
      end; // for j
    end
    else
      EmbeddedWB.LoadFromWideString(idMsg.Body.Text);
 
  end; // for i
 
  ViewAttach.EndUpdate;
 
end;
Merci de vos réponse, là je patauge grave