Connect multiple logins via IMAP!

0

I have several accounts in the PROVIDER EARTH here of the company, and I created a program that will check the email from time to time. So far so good, the program is working when it's just a login.

It turns out that since we have multiple accounts, I need to do several checks at the same time, or the program connects, checks one, closes, then jumps to the other, any idea how I can do it? The logins / passwords are inside a .txt file.

I'm doing it this way:

  Linhas := TStringList.Create;
  Colunas := TStringlist.Create;
  Colunas.Delimiter := ';';
  try
    Linhas.LoadFromFile('emails.txt');

    for i := 0 to Linhas.Count-1 do
    begin
       Colunas.DelimitedText := Linhas[i];
    end;

  finally
    Linhas.Free;
  end;

  // CÓDIGO PARA CONECTAR NO IMAP

iMap.Host := 'imap.terra.com.br'; 
iMap.Username := Colunas[0];
iMap.Password := Colunas[1];
imap.Connect();
imap.SelectMailBox('INBOX');

It does not work at all, it connects only once, after an imap error. What am I doing wrong?

I look forward to any help!

    
asked by anonymous 05.03.2018 / 23:27

0 answers