Class File in C#
-----------------------
But I have a problem i can read the mail only once ... for the next time the it is not avilable
any one can help me out.....
thanks in advance
-----------------------
Code:
// connect to pop server
SmtPop.POP3Client pop = new SmtPop.POP3Client ();
pop.Open ("localhost", "110", "mylogin", "mypasword");
// get messages list from pop server
SmtPop.POPMessageId[] messages = pop.GetMailList ();
if (messages != null)
{
// Walk attachment list
foreach (SmtPop.POPMessageId id in messages)
{
SmtPop.POPReader reader = pop.GetMailReader (id.Id);
SmtPop.MimeMessage msg = new SmtPop.MimeMessage ();
// read message
msg.Read (reader);
if (msg.Attachments != null)
{
// do something with first attachment
SmtPop.MimeAttachment attach = msg.Attachments[0];
if (attach.Filename == "data")
{
// read data from attachment
Byte[] b = Convert.FromBase64String (attach.Body);
System.IO.MemoryStream mem = new System.IO.MemoryStream (b, false);
BinaryFormatter f = new BinaryFormatter ();
DataClass data = (DataClass) f.Deserialize (mem);
mem.Close();
}
//delete message
pop.Dele (id.Id);
}
}
}
}
pop.Quit ();
But I have a problem i can read the mail only once ... for the next time the it is not avilable
any one can help me out.....
thanks in advance
Comment