Пример #1
0
        private static MailAddress BuildMailAddress(SafeRecipient recipient)
        {
            if ("EX" == recipient.AddressEntry.Type) //exhange recipient
            {
                string smtpAddress = (string)recipient.get_Fields(0x39FE001E);

                if (null == smtpAddress)
                {
                    
                }

                return new MailAddress(smtpAddress, recipient.Name);
            }
            else
            {
                return new MailAddress(recipient.Address, recipient.Name);
            }
        }
Пример #2
0
        protected IRoutingItem MakeSMTPRoutingItem(SafeRecipient recipient)
        {
            AddressEntry addrEntry = recipient.AddressEntry;
            object MAPIProp = addrEntry.MAPIOBJECT;

            using (new ComObjectGovernor(MAPIProp))
            using (new ComObjectGovernor(addrEntry))
            {
                if ("EX" == addrEntry.Type) //exchange recipient
                {
                    string smtpAddress = null;

                    smtpAddress = GetUtils().HrGetOneProp(MAPIProp, 0x39FE001E) as string;

                    if (null == smtpAddress)
                    {
                        smtpAddress = recipient.get_Fields(0x39FE001E) as string;
                    }

                    if (null == smtpAddress)
                    {
                        string msg = String.Format(System.Threading.Thread.CurrentThread.CurrentCulture,
                            "Failed to get a valid smtp address for recipient: {0}", recipient.Name);
                        Logging.Trace.WriteLine(msg, "RedemptionMailConverter.BuildMailAddress");
                    }

                    return MakeSMTPRoutingItem(smtpAddress, recipient.Name);
                }
                else
                {
                    return MakeSMTPRoutingItem(recipient.Address, recipient.Name);
                }
            }
        }