pcmaker

webform1.aspx

Nov 29th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.55 KB | None | 0 0
  1. public partial class WebForm1 : System.Web.UI.Page
  2.     {
  3.         private void receivemail()
  4.         {
  5.             POP3_Client clt = new POP3_Client();
  6.             clt.Connect("sunucu", 110, false);
  7.             clt.Authenticate("mail", "parola", true);
  8.             clt.Timeout = int.MaxValue;
  9.  
  10.             List<MyVeriler> MailListesi = new List<MyVeriler>();
  11.  
  12.             foreach (POP3_ClientMessage item in clt.Messages)
  13.             {
  14.                 Mail_Message mime = Mail_Message.ParseFromByte(item.MessageToByte());
  15.  
  16.                 MailListesi.Add(new MyVeriler
  17.                 {
  18.                     MsgID = item.UID,
  19.                     Konu = mime.Subject,
  20.                     Tarih = mime.Date.ToString("dd.MM.yyyy"),
  21.                     Gonderen = mime.From.ToString(),
  22.                     Dosyalar = mime.Attachments.Select(p => p.ContentType.Param_Name).ToList()
  23.                 });
  24.             }
  25.         }
  26.  
  27.         protected void Page_Load(object sender, EventArgs e)
  28.         {
  29.             receivemail();
  30.         }
  31.  
  32.     }
  33.     public class MyVeriler
  34.     {
  35.         public string MsgID { get; set; }
  36.         public string Gonderen { get; set; }
  37.         public string Tarih { get; set; }
  38.         string _Konu;
  39.  
  40.         public string Konu
  41.         {
  42.             get
  43.             {
  44.                 return _Konu;
  45.             }
  46.             set
  47.             {
  48.                 _Konu = value.Length > 27 ? value.Substring(0, 27).ToString() + "..." : value;
  49.             }
  50.         }
  51.  
  52.         public List<string> Dosyalar { get; set; }
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment