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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.