private void buttonAddRecipient_Click(object sender, EventArgs e) { formInputDialog inputDialog = new formInputDialog(); inputDialog.Title = "Address"; inputDialog.Text = "Enter email address"; if (inputDialog.ShowDialog() == DialogResult.OK) { hMailServer.DistributionListRecipients recipients = representedObject.Recipients; hMailServer.DistributionListRecipient recipient = recipients.Add(); recipient.RecipientAddress = inputDialog.Value; recipient.Save(); Marshal.ReleaseComObject(recipients); Marshal.ReleaseComObject(recipient); } ListRecipients(); }
private void buttonSelectRecipients_Click(object sender, EventArgs e) { formSelectUsers selectUsers = new formSelectUsers(true, 0); if (selectUsers.ShowDialog() == DialogResult.OK) { hMailServer.DistributionListRecipients recipients = representedObject.Recipients; List <string> listUsers = selectUsers.GetSelectedTexts(); foreach (string address in listUsers) { hMailServer.DistributionListRecipient recipient = recipients.Add(); recipient.RecipientAddress = address; recipient.Save(); Marshal.ReleaseComObject(recipient); } Marshal.ReleaseComObject(recipients); ListRecipients(); } }
public IDistributionListRecipient Add() { return(new DistributionListRecipient(_object.Add())); }