2012-06-22 51 views
4

我从Outlook联系人看了我的联系方式,然后我将联系人添加到MailMessage mail.To.Add("John Doe <John Doe>")但我收到此错误:发送电子邮件至交易所的Outlook联系人电子邮件地址

The specified string is not in the form required for an e-mail address.

我怎样才能解决这个问题?当我从Outlook联系人中读取电子邮件地址的结果是一长串这样的(仅适用于Exchange帐户类型),我prse得到最后CN =值: /o=First Organization/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Recipients/cn=John Doe

我怎样才能读取正确Ë来自Exchange帐户的电子邮件地址([email protected])或其他发送电子邮件的方法?

回答

3

如果您有ExchangeUser,则可以访问Exchange电子邮件的属性PrimarySmtpAddress。然后下面应该为你工作...

MailMessage mail = new MailMessage(); 
mail.To.Add(exchangeUser.PrimarySmtpAddress); 
+2

感谢这工作我从addressEntry.GetExchangeUser();交换用户; – user1474441

相关问题