C# / Exchange EMail Client

北战南征 提交于 2019-12-01 20:14:09

问题


I need to create a very simple c# Windows Service to listen for, and process email wth special subject lines. I already have the code that process these emails working well. For ease of development, I just packaged the code in an "Outlook Addin" on my own machine, running under my own email account. Works great.

Now that it's working, I need to move this to the server. I have a special email account setup on the Exchange Server for this purpose. I really don't want Outlook running on the server. Is there some other way to login to this email account and listen for email from my Windows Service without using the Outlook client?

Thanks!


回答1:


It sounds like your code is closely tied to Outlook, so you may have to change your approach for the server. I faced exactly the same problem last year and considered the following options :

  • CDO (not supported by Microsoft with .NET due to some strangeness when running in process)
  • WebDAV for Exchange 2003
  • Web Services for Exchange 2007 (great example in the link)

You also need to ask yourself - do you actually need your program to check the mail server? I couldnt use any of the above options so ended up having one of the mail admins set up an exchange rule that dropped the emails/attachments into a special folder on the server. I could then process the files at my leisure. Worked extremely well and much easier to maintain than directly interrogating the mail server through code.




回答2:


If your exchange admin has enabled it you can use IMAP or POP3 to connect to the server.

You can also use MAPI to connect as well.

You can find a number of libraries (free and otherwise) for doing all three.

I have had good experience with MailBee IMAP but there are definitely free alternatives if you only need to do some simple functionality.



来源:https://stackoverflow.com/questions/1973053/c-sharp-exchange-email-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!