Jump to content

How download mail from pop or imap server


AntonioCuomo

Recommended Posts

42 minutes ago, AntonioCuomo said:

I would like to insert in unigui a client to download e-mails and manage the content of messages. I had thought of using IDPop3 but I can't find examples on the net.

Hello,

Sorry, it's not very clear what you want.

Link to comment
Share on other sites

I have the impression that the problem is in these lines of Tipwpop3:

function TipwPOP.get_MessageText: String;
var
  tmp: Pointer;
begin
  result := '';

  if @_IPWorks_POP_Get = nil then exit;
  tmp := _IPWorks_POP_Get(m_ctl, PID_POP_MessageText{$IFDEF UNICODE}+10000{$ENDIF}, 0, nil, nil);
  result := PChar(tmp);
end;

in the VCL version, result contains the complete string while in unigui only the first part (about 50 characters).

It seems that unigui doesn't recognize {$ IFDEF UNICODE} +10000 {$ ENDIF}.
I should try to modify the IpWork library.

Is it a problem of unigui?

In previous posts I have attached a test in unigui.

Apart from my specific use, such an application would allow the mail client to be centralized on a single server.

 

Link to comment
Share on other sites

It is working fine with Indy POP3, got over 8000 characters in one message while testing against Google Mail.

//Message: TListView component set at vsReport

procedure TmainForm.ReadEmails;
var
  IDmessage: TIdMessage;
  i: Integer;

begin
  try
    with POP3 do
    begin
      AutoLogin := False;
      Host := 'pop.gmail.com';
      Username := '******@gmail.com';
      Password := '*******';
      Port := 995;
      IOHandler := IOHandlerTLS;
      UseTLS := utUseImplicitTLS;
    end;
    with IOHandlerTLS do
    begin
      Destination := 'pop.gmail.com:995';
      Host := 'pop.gmail.com';
      Port := 995;
      DefaultPort := 0;
      SSLOptions.Method:=sslvTLSv1_2;
    end;
    POP3.Connect;
    POP3.Login;
    try
      Messages.Clear;
      IDmessage := TIdMessage.Create(nil);
      try
        //for i := 1 to POP3.CheckMessages do
        for i := 1 to 10 do
        begin
          IDmessage.Clear;
          POP3.Retrieve(i, IDmessage);
          Messages.Items.Add;
          Messages.Items[i - 1].Caption:=DateToStr(IDmessage.Date);
          Messages.Items[i - 1].SubItems.Add(IDmessage.From.Address);
          Messages.Items[i - 1].SubItems.Add(IDmessage.Subject);
          Messages.Items[i - 1].SubItems.Add(IDMessage.Body.Text);
        end;
      finally
        FreeAndNil(IDmessage);
      end;
    finally
      POP3.Disconnect;
    end;
  except
    on e : Exception do
      ShowMessage('error=' + e.Message);
  end;
end;

 

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...