示例#1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            User = new User(TextBoxLogin.Text, TextBoxPassword.Text);
              Mailad = new MailAdapter("imap.gmail.com", 993, User.Email, User.Password);

            WindowMail winmail = new WindowMail(User, Mailad);
               winmail.Show();
        }
示例#2
0
 public void SendMail(User suser, string sendto, string subject, string body)
 {
     if (suser != null)
     {
         MailAddress from = new MailAddress(suser.Email, suser.Name);
         MailAddress to = new MailAddress(sendto);
         MailMessage mesg = new MailMessage(from, to);
         mesg.Subject = subject;
         mesg.Body = body;
         client.Send(mesg);
     }
 }
示例#3
0
        public ClientSmtp(string host, int port, User usr)
        {
            Host = host;
            Port = port;
            user = usr;

             client = new SmtpClient(host, port)
             {
             Credentials = new NetworkCredential(user.Email, user.Password),
             EnableSsl = true
             };
        }
示例#4
0
        public WindowMail(User user, MailAdapter mail)
        {
            InitializeComponent();
            Mailadp = mail;
            User = user;
                ListBoxFolder.ItemsSource = mail.ListMailboxes();
            IEnumerator messageenum = Mailadp.GetEnumerator();
            MessEnumerator = messageenum;
            uint uid = mail.GetMailboxInfo().NextUid;
                IEnumerable<uint> uids = mail.Search(SearchCondition.Unseen());

                foreach (uint uidd in uids)
                {
                    MailMessage message = mail.GetMessage(uidd);
                mail.MailMessages.Add(message);
                    ListBoxMail.Items.Add(message.From + " " + message.Subject);
                }
        }
示例#5
0
 public WindowSend(User user)
 {
     InitializeComponent();
     Usr = user;
 }