Exemplo n.º 1
0
        private ArrayList filePaths;    //添加的附件数组



        public Edit(string userName, string password)
        {
            InitializeComponent();

            from               = userName;
            filePaths          = new ArrayList();
            From_Label.Content = from;

            smptControler = new SMTPControler();
            smptControler.Init(userName, password);


            // 读取最近联系人
            RecentContacts recentContacts = new RecentContacts(userName);
            // 展示最近联系人
            List <string> ContactsList = recentContacts.BackEmail();

            ShowRecentContacts(ContactsList);

            Console.WriteLine("最近联系人信息为:");
            foreach (string s in ContactsList)
            {
                Console.WriteLine(s);
            }
        }
Exemplo n.º 2
0
        // 发送邮件
        private void SendEmail()
        {
            subject = Subject_TextBox.Text;
            body    = GetNewBody(System.Windows.Markup.XamlWriter.Save(Email_Body.Document));
            to      = To_Address.Text;

            MailMessage msg = smptControler.CreateMessage(from, to, subject, body, filePaths);

            smptControler.Send(msg);

            // 如果发送成功,更新最近联系人列表
            RecentContacts recentContacts = new RecentContacts(from, to);
            // 展示最近联系人
            List <string> ContactsList = recentContacts.BackEmail();

            ShowRecentContacts(ContactsList);

            MessageBox.Show("发送成功");
        }