CharpMail was moved to HigLabo project!!!
http://higlabo.codeplex.com/
Improve performance, add IMAP functionality and more.
Please check it out!!


Basic usage

//Receive mail
Pop3Client cl = new Pop3Client();
cl.ServerName = "your server name";
cl.UserName = "your name";
cl.Password = "pass";
cl.Ssl = false;
if (cl.Authenticate() == true)
{
   Int32 MailIndex = 1;
   Pop3Message mg = cl.GetMessage(MailIndex);
   String mailTo = mg.To;
   String mailCc = mg.Cc;
   String title = mg.Subject;
   String bodyText = mg.BodyText;
   //Save Image to your local hard disk
   foreach(Pop3Content ct in mg.Contents)
   {
      String filePath = "C:\MyFolder\" + ct.ContentDisposition.FileName;
      ct.DecodeData(filePath);
   }
}

//Delete selected Mail
Pop3Client pop = new Pop3Client("mymail@mydomain.com", "mypass", "mail.myserver.com");
pop.Port = 110;
pop.AuthenticateMode = Pop3AuthenticateMode.Pop;
Int64[] DeleteIndexList = new.....//It depend on your needs
cl.DeleteEMail(DeleteIndexList);

//Send mail
SmtpClient cl = new SmtpClient();
cl.ServerName = "your server name";
cl.Port = 25;
cl.Ssl = false;
SmtpMessage mg = new SmtpMessage();
mg.Subject = "title";
mg.BodyText = "Hi.my mail body text!";
mg.From = "my_address@mail.com";
mg.To.Add(new MailAddress("address@mail.com"));
cl.SendMail(mg);


Last edited Sep 19, 2012 at 10:03 AM by higty, version 8

Comments

hoduyloi Oct 20, 2011 at 1:57 PM 
hi, how can I read or get attachment from new messages only?

Thank you :)