public static bool ComposeMessage(MailMessage msg) { MessageFrm dlg = new MessageFrm(); dlg.btnAppend.Visible = true; dlg.btnCancel.Text = "Cancel"; dlg.edtFrom.ReadOnly = false; dlg.edtTo.ReadOnly = false; dlg.edtSubject.ReadOnly = false; dlg.memBody.ReadOnly = false; dlg.edtFrom.Text = "*****@*****.**"; dlg.edtTo.Text = "*****@*****.**"; dlg.edtSubject.Text = "Test Subject"; dlg.memBody.Text = "Test Body"; if (dlg.ShowDialog() == DialogResult.OK) { msg.BuildMessage(dlg.memBody.Text, ""); msg.From.FullAddress = dlg.edtFrom.Text; msg.ToList.EmailAddresses = dlg.edtTo.Text; msg.Subject = dlg.edtSubject.Text; return(true); } return(false); }
private void btnAppend_Click(object sender, System.EventArgs e) { if (!imap41.Active) { return; } if (tvFolders.SelectedIndex > -1) { if (MessageFrm.ComposeMessage(mailMessage1)) { imap41.AppendMessage(tvFolders.SelectedItem.ToString(), mailMessage1, MailMessageFlags.None); tvFolders_SelectedIndexChanged(null, null); } } }
private void lvMessages_DoubleClick(object sender, System.EventArgs e) { if (!imap41.Active) { return; } if (lvMessages.SelectedItems.Count > 0) { imap41.RetrieveMessage(Convert.ToInt32(lvMessages.SelectedItems[0].Text), mailMessage1); imap41.SetMessageFlags(Convert.ToInt32(lvMessages.SelectedItems[0].Text), SetFlagsMethod.Add, MailMessageFlags.Seen); MessageFrm.ShowMessage(mailMessage1); tvFolders_SelectedIndexChanged(null, null); } }
public static void ShowMessage(MailMessage msg) { MessageFrm dlg = new MessageFrm(); dlg.btnAppend.Visible = false; dlg.btnCancel.Text = "Close"; dlg.edtFrom.ReadOnly = true; dlg.edtTo.ReadOnly = true; dlg.edtSubject.ReadOnly = true; dlg.memBody.ReadOnly = true; dlg.edtFrom.BackColor = SystemColors.Window; dlg.edtTo.BackColor = SystemColors.Window; dlg.edtSubject.BackColor = SystemColors.Window; dlg.memBody.BackColor = SystemColors.Window; dlg.edtFrom.Text = msg.From.FullAddress; dlg.edtTo.Text = msg.ToList.EmailAddresses; dlg.edtSubject.Text = msg.Subject; dlg.memBody.Lines = msg.MessageText; dlg.ShowDialog(); }