Пример #1
0
        private static MapiRecipDesc[] GetRecipients(EmailAddressList addresses)
        {
            var recipients = new List <MapiRecipDesc>();

            foreach (EmailAddress addr in addresses)
            {
                var mapiDesc = new MapiRecipDesc();
                if (string.IsNullOrEmpty(addr.Name))
                {
                    // If the recipients name was not specified, we must
                    // set the name to the email address or MAPI32 will
                    // return an error.
                    mapiDesc.Name = addr.Address;
                }
                else
                {
                    mapiDesc.Name    = addr.Name;
                    mapiDesc.Address = addr.Address;
                }
                mapiDesc.RecipientClass = (uint)addresses.AddressType;
                recipients.Add(mapiDesc);
            }

            return(recipients.ToArray());
        }
Пример #2
0
 /// <summary>
 /// Creates an instance of Message.
 /// </summary>
 public Message()
 {
     To          = new EmailAddressList(EmailAddressType.To);
     CC          = new EmailAddressList(EmailAddressType.CC);
     BCC         = new EmailAddressList(EmailAddressType.BCC);
     Attachments = new AttachmentList();
     mSendAsyncCompleteCallback = new SendOrPostCallback(SendAsyncWorkerCompleted);
 }