Jump to content

Imap and body msg


AntonioCuomo

Recommended Posts

I try to read the content of the emails downloaded with tidimap4:

        //--------------------------------------------------------
        for i := 0 to TCount-1 do
            begin
             IdIMAP41.GetUID(i+1, TheUID);
             IdIMAP41.UIDRetrieveFlags(TheUID, TheFlags);
             IdIMAP41.UIDRetrieveHeader(TheUID, MSG);
             MSG.MessageParts.CountParts;
             pp := msg.MessageParts.TextPartCount;
                  if NOT (mfSeen in TheFlags) then
                     begin // UnRead message!
                     if not(FDTHeader.FindKey([MSG.MsgId])) then
                        begin
                        //------------------------------------------------------
                        // Legge body
                        //------------------------------------------------------

                           try
                             if pp > 0 then
                                   begin
                                     for var k := 0 to msg.MessageParts.Count - 1 do
                                         begin
                                           if msg.MessageParts[k] is TIdText then
                                               begin
                                                  S := S + TIdText(msg.MessageParts[k]).Body.Text;
                                               end

                                          else
                                               begin
                                                 s := msg.body.text;
                                               end;
                                         end;
                                   end;
                           finally
                           bodytext := s;

 

with vcl application it works fine, but with unigui I can't read the number of parts of the message.
In practice the function msg.messageparts.countparts in unigui gives me as a result 0.

Link to comment
Share on other sites

Fixed mancava re-reading the message:
                        //------------------------------------------------------
                        // Legge body
                        //------------------------------------------------------
                        IdIMAP41.UIDRetrieve(TheUID, MSG);
                          MSG.MessageParts.CountParts;
                          pp := msg.MessageParts.TextPartCount;

                           try...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...