Exemplo n.º 1
0
        private void NewMailToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // open edit mail form to edit email
            EditMail editMail = new EditMail();
            editMail.ShowDialog();
            if (editMail.DialogResult == DialogResult.OK)
            {
                if (editMail.SendTarget == EditMail.Target.Remote)
                    backgroundWorkerSend.RunWorkerAsync(editMail);
                else
                {
                    // save to draft box
                    MailMessage msg = editMail.MSG;
                    SmtpClient client = editMail.Client;
                    client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                    string filepath = Utility.GetDraftPath();
                    client.PickupDirectoryLocation = filepath;
                    client.EnableSsl = false;
                    client.Send(msg);

                    // update view
                    LoadEmailDB();
                    UpdateGridView();
                }
            }
        }
Exemplo n.º 2
0
        private void ShowMail(string id)
        {
            ViewMail viewMail = new ViewMail();
            viewMail.ID = id;
            viewMail.ShowDialog();

            if (viewMail.DialogResult == DialogResult.OK)
            {
                EditMail editMail = new EditMail();
                editMail.MailBody.AppendText("\n\n\n");
                editMail.MailBody.AppendText("-------------------------------------------");
                editMail.MailBody.AppendText("\n");
                editMail.MailBody.AppendText(viewMail.GetContent());
                editMail.MailBody.Select(0, 0);
                editMail.Receiver = viewMail.To;
                editMail.Subject = "RE: " + viewMail.Title;
                editMail.ShowDialog();

                if (editMail.DialogResult == DialogResult.OK)
                {
                    if (editMail.SendTarget == EditMail.Target.Remote)
                        backgroundWorkerSend.RunWorkerAsync(editMail);
                    else
                    {
                        // save to draft box
                        MailMessage msg = editMail.MSG;
                        SmtpClient client = editMail.Client;
                        client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                        string filepath = Utility.GetDraftPath();
                        client.PickupDirectoryLocation = filepath;
                        client.EnableSsl = false;
                        client.Send(msg);

                        // update view
                        LoadEmailDB();
                        UpdateGridView();
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void EditDraft(string id)
        {
            EditMail editMail = new EditMail(id);
            editMail.ShowDialog();

            if (editMail.DialogResult == DialogResult.OK)
            {
                // draft will be deleted, whether it is been sent or drafted again
                string fullpath = id;
                if (File.Exists(fullpath))
                {
                    // delete it
                    File.Delete(fullpath);
                }

                if (editMail.SendTarget == EditMail.Target.Remote)
                    backgroundWorkerSend.RunWorkerAsync(editMail);
                else
                {
                    // save to draft box
                    MailMessage msg = editMail.MSG;
                    SmtpClient client = editMail.Client;
                    client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                    string filepath = Utility.GetDraftPath();
                    client.PickupDirectoryLocation = filepath;
                    client.EnableSsl = false;
                    client.Send(msg);

                    // update view
                    LoadEmailDB();
                    UpdateGridView();
                }
            }
        }