发送asp.net中使用Exchange Server(微软的Outlook Web Access)邮件 [英] Send mails using EXCHANGE SERVER (Microsoft Outlook web access)in asp.net

查看:189
本文介绍了发送asp.net中使用Exchange Server(微软的Outlook Web Access)邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何使用安装在同一台机器上,在那里我跑我的code Outlook发送邮件。
现在,这里的要求是访问我的组织中的Exchange Server(微软OWA)在asp.net code发送邮件。

I know how to send mails using outlook installed in same machine, where I'm running my code. Now, the requirement here is to access exchange server (Microsoft OWA) of my organization for sending mails in asp.net code.

这可能吗?如果是,则PLZ抛出一些轻。

Is it possible? If yes, then plz throw some light.

日Thnx

更新

UPDATE

得到了解决。在这里张贴我的工作code谁愿意帮助任何一个。编码快乐!

protected void Button1_Click(object sender, EventArgs e)
{
     ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
    //service.AutodiscoverUrl("youremailaddress@yourdomain.com");

    service.Url = new Uri("https://yourwebmailaddress.com/ews/Exchange.asmx");

    service.UseDefaultCredentials = true;
    //service.Credentials = new WebCredentials("username", "password");


    EmailMessage message = new EmailMessage(service);
    message.Subject = "My auto mail from exchange server";
    message.Body = "hi everyone !";
    message.ToRecipients.Add("brad.pitt@hollywood.com");
    message.Save();

    message.SendAndSaveCopy();

    Label1.Text = "Success !";    
}

另一个问题:如何使用Microsoft Exchange 2003? '怎么EWS不存在支持。请更新任何想法...?

Another Question: How to use microsoft exchange 2003 ?? 'coz EWS is not supported in there. Please update any idea...?

推荐答案

您可以发送使用Exchange Web服务API(EWS)的电子邮件。 EWS是一套托管在同一台服务器上的OWA老式ASMX Web服务。微软甚至已经发表了管理API包装为EWS。

You can send emails using the Exchange Web Services API (EWS). EWS is a set of old fashioned ASMX web services hosted on the same server as OWA. Microsoft has even published a managed API wrapper for EWS.

下面是一个关于如何使用发送电子邮件EWS一个例子:
HTTP://$c$c.msdn.microsoft.com /发送的电子邮件与 - 交易所50189e57

Here is an example on how to send emails using EWS: http://code.msdn.microsoft.com/Send-Email-with-Exchange-50189e57

通常EWS可以在 HTTP上找到://yourexchangeserver/ews/exchange.asmx 但与管理API,您可以使用自动搜索,自动找到EWS的地址您的Exchange服务器。

Usually EWS can be found at http://yourexchangeserver/ews/exchange.asmx but with the managed API you can use autodiscovery to automatically find the address of EWS on your Exchange server.

下面是一个概述那里的东西像自动发现功能进行了说明。

Here is an overview where things like autodiscovery are explained.

有关更新Exchange 2003的:

您可以使用WebDAV通过HTTP访问Exchange 2003邮件存储。 WebDAV是一个痛苦位的使用,因为你可能必须使用基于表单的身份验证(FBA),如果这是您的OWA安装需要什么(比较EWS可以使用Windows身份验证,即使OWA在Exchange 2007/2010使用FBA)。

You can access the Exchange 2003 mail store via HTTP using WebDAV. WebDAV is a bit of a pain to use because you may have to use Forms Based Authentication (FBA) if that is what your OWA installation requires (in comparison EWS can use Windows Authentication even if OWA on Exchange 2007/2010 is using FBA).

我从来没有尝试发送使用WebDAV邮件进行交流(虽然我已经使用WebDAV的为一些其他的东西),但我发现的 MSDN上的例子,你可能想尝试。它使用Windows身份验证,因此,如果您的Exchange 2003 OWA被设置为使用FBA它不会工作。如果您需要使用FBA让我知道 - 我可能有,你可以使用一些样本code某处

I have never tried sending mails using WebDAV for Exchange (although I have used WebDAV for a number of other things) but I found an example on MSDN that you may want to try. It uses Windows Authentication so it will not work if your Exchange 2003 OWA is set up to use FBA. If you need to use FBA let me know - I may have some sample code somewhere that you can use.

这篇关于发送asp.net中使用Exchange Server(微软的Outlook Web Access)邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆