Assign specific email account to retrieve mail using POP3 Indy Component

I am trying to retrieve mail for a specific email address.  I can connect to the mail server fine, but how or where do I assign which mailbox I want to search?  

POP.Host := 'myHost.com';
POP.Port := 110;
POP.Username := 'TestEmail';
POP.Password := 'test';
  try
    POP.Connect;
  except
    on E : Exception do
      begin
        ShowMessage('Error: '+ E.Message);
      end;
  end;
jennifereAsked:
Who is Participating?
 
alunaCommented:
Do you read your inbox with another POP3 client? If so, check for account config settings like secure password authentication, ssl ports, or any other. Maybe when you connect to the server thare's some special config to let you access the mailbox.
0
 
alunaCommented:
Hi
I don't understand what you want to do, 'cause the component provides direct access to the mailbox for the username and password combination you're using. You have not to assign any other property. After connect, you could use the CheckMessages method to obtain the number of messages in the mailbox and the methods RetrieveHeader or Retrieve to get the message headers only or complete messages.

POP.Host := 'myHost.com';
POP.Port := 110;
POP.Username := 'TestEmail';
POP.Password := 'test';
  try
    POP.Connect;
    num := POP.CheckMessages;
    for i := 0 to num - 1 do
      begin
        POP.Retrieve(i, msg);
        // then you have in msg (of type TIdMessage) all message's properties, such as Subject,
        // Sender, From, etc...
      end;

  except
    on E : Exception do
      begin
        ShowMessage('Error: '+ E.Message);
      end;
  end;
0
 
jennifereAuthor Commented:
Right, I thought using the username and password would give me direct access to my mailbox, however, when I check the mailbox size or call CheckMessages, I am returned a 0.  That's why I thought I might need to assign my mailbox somewhere else. There are messages in this mailbox, I just can not get them.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.