pop3
Boa tarde pessoal...
estou com o seguinte problema...
estou com um robo aqui.. em console app... ele pega o email e salva em uma pasta...
até ae beleza... só que ele só esta pegando um eamil não sei pq :/
segue o codigo quem puder ajudar...
eu gostaria de pagar tdos os emails.
using System;using System.Collections.Generic;using System.Text;using ANPOPLib;namespace ConsoleApplication2{ class Program { static void Main(string[] args) { //Criando os Objetos e instan... POPMAINClass oPop3 = new POPMAINClass(); POPMSGClass oMsg = new POPMSGClass(); int i = 0, nRet = 0, nSize = 0, nCount = 0; string emailContent = "", messageId = ""; try { nRet = oPop3.Connect("pop.server.com.br", "marcel@server.com.br", "xxxxxx"); //Conecta no pop3 server if (nRet != 0) throw new Exception("Erro ao Conectar"); nCount = oPop3.GetTotalOfMails(); //Pega o nº de Emails if (nCount == -1) throw new Exception("Erro ao pegar o total de emails"); else if (nCount == 0) throw new Exception("sem email"); for (i = 1; i <= nCount; i++) { nSize = oPop3.GetMsgSize(i); //Pega o Tamanho do email if (nSize == -1) throw new Exception("Erro ao pegar o tamanho do email"); messageId = oPop3.GetMsgID(i); //Pega msgid if (messageId == null) throw new Exception("Erro ao pegar o messageId"); emailContent = oPop3.Retrieve(i); //Pegando os Emails if (emailContent == null) throw new Exception("Erro ao pegar os emails"); oMsg.RawContent = emailContent; nRet = oMsg.ExportFile( String.Format("c:\\emails{0}.txt", i)); //Salva o email if (nRet != 0) throw new Exception("error with ExportFile"); } } catch (Exception e) { Console.WriteLine(e.Message); } oPop3.Close(); oPop3 = null; oMsg = null; } }}Obrigado pessoal abrax
Discussão (1)
Carregando comentários...