Accessing all email on Exchange Server - exchange-server

I would like to programmatically be able to access all the emails stored in an exchange server in order to do some text analysis on those emails. How would I go about this, assuming I had all the necessary permissions and direct access to the server?

My gut says you should use eDiscovery tools built into Exchange, but I'm not entirely sure that will accomplish what you want. eDiscovery does what it was designed to do pretty well, but that's entirely focused around finding emails in a date range or via keyword.

Related

Is there a way to connect to Exchange Online using Logic Apps? Do I need to use a REST-api or EWS?

i'm quite new to Logic Apps. I got the task to make an auto reply function within Logic Apps that integrates with Exchange Online. Now I already performed this task using Outlook, but I have to be able to apply it to multiple mailboxes or even the entire company using Exchange. I'm about to get access to the Exchange Admin Center soon, but I don't really know how to start due to the fact that there is no simple way to make a connection to Exchange using Logic Apps. After some research, I think it's necessary for me to somehow make use of a REST API (I also read about the use of Exchange Web Services) to get the information I need, but my knowledge about this is quite small. I guess I'm gonna have to use a program like Postman to request information, so that I can start creating Custom Connectors to Exchange. If anybody has some understanding about this, feel free to reply and help me out! I will forever be gratefull!
There are several different approaches you could take to this if you (or probably they in your case) want your logic app to do all the work then you should use the Graph API rather then EWS (while its possible because its older API you'll loose marks on your assignment) have a look at http://martink.me/articles/using-microsoft-graph-in-logic-apps which covers the basics of what to do. To Get access to mailboxes tenant wide then you need to assigned Application Permission and get certificate (and store that in the KeyVault on Azure etc).
You can do this using Inbox Rules https://learn.microsoft.com/en-us/graph/api/mailfolder-post-messagerules?view=graph-rest-1.0&tabs=http and the Exchange Server will do all the work when it comes to doing the Auto-response (and has loop detection logic already) and your logic app then just need to do the Creation and management of the Rules.
But I would suggest you clarify with the person who assigned you the task whether they want the logic app to do the response (eg using the Graph API) or if its okay for the Exchange Server to do this for then (which should be more reliable).
You can also create Rules via the Exchange Admin Center and you could probably also through in Power Automate into the mix to do Autoresponse's so I'd clarify what they want so you don't waste time building something they don't want.

Mine messages in exchange server

I am trying to find out if there is way to inspect all messages that are flowing through an exchange server for mining purposes. I came across exchange server web services, but not sure how to use them. Is there anyway I can get a copy of all the email messages that are flowing though an exchange server?
EWS has several mechanisms to subscribe to mail events on the server, i.e. 3 types of notifications plus a synchronization mechanism. However, I don't think this would scale well to trapping everything flowing through the server. For one thing, subscriptions target individual folders within the Exchange store, not the entire store. For another, EWS requires authorization for each mailbox you want access to. Lastly, the volume of events generated by an enterprise-size Exchange server would overwhelm any single process, and thus your app would have to scale out as needed.
Assuming proper authorization, you might be able to browse through each mailbox on the server at a particular interval, however this would need to be done with restraint so as not to hit the EWS's throttling limits. And this could potentially miss things that came and went in between browses.
If you only need to get a copy of all messages, there are various ways to do this.
Recommended would be to create either a transport rule, or a journal rule to direct mail to another mailbox.
EWS scripting can be complex and is certainly not needed on Exchange server to receive a copy of all in and outbound messages.
Additionally, if you need to get a copy of all messages in User mailboxes as well (to archive for prep to move forward with a journalling service, say), then there also are Powershell commands you can use with ExMerge creds to export to pst. (New-MailboxExportRequest is scriptable, say)

Which setup to use for email handling platform

My goal is to build a system where each user has an email address to which he can forward e-mails. From these emails the system should take: subject, date, recipient, text. This data should go into a database with a unique ID per mail and user.
Now I know this doesn't sound that complicated, but I am wondering which programming language to use. Also I wonder how to host the email, since there will be quite some email addresses and there should be some job running to detect when new emails are coming in.
Not very experienced at this so hoping that some of you could give me some tips to look into. I hope this question is not too general - I did my best to be specific. All input is very much appreciated.
Thanks,
Vincent
Essentially you need three components
A Mail Server (to receive the emails) Look at MS Exchange (Windows) or Postfix (Linux) as examples
Some code to parse the incoming emails, you could use almost anything to do this
A database, look at SQL Server, My SQL as examples
Your question is a bit broad to give more specific advice

MS Exchange Server 2003: any good scripting tutorial?

I need to write a script for MS Exchange Server 2003 that will analyze incoming emails and put some of them into a specific mailbox. Of course it's a lot of information about Exchange Server scripting at MSDN, but amount of information there is very huge. Is it some simple tutorials available that will describe how to install a simple script on MS Exchange Server that will analyze incoming emails?
I believe the only way to accomplish what you want in exchange 2003 is to write an smtp event sink. Here is an overview. http://www.codeproject.com/KB/cs/csmanagedeventsinkshooks.aspx
Unfortunately, event sinks can be prone to have very poor performance characteristics and are generally discouraged. However, I believe that is the way to accomplish what you want to do.
If you decide to go down this path, here are a couple of references for you:
http://support.microsoft.com/kb/894286 and
http://msdn.microsoft.com/en-us/library/ms998610.aspx
Try these? (the first one is for exchange 07)
http://www.codeproject.com/KB/exchange/Exchange2007EWS-Part1.aspx
http://www.codeproject.com/KB/cs/Exchange_2003_with_WebDav.aspx

Standard Signature a Text in a Message using Exchange Server

Anyone know how to do this without using a third party program? If there no way to do it with a add-on someone can recommend one?
EDIT: I need to add this in the server so all users have the same signature.
Thanks
You need to create your own exchange message sink to do this. Here's a classic VB example from MS KB:
http://support.microsoft.com/kb/317327
and a VB Script one:
http://support.microsoft.com/kb/317680
And lots of goodness from MSDN about Exchange 2003 Transport Event Sinks:
http://msdn.microsoft.com/en-us/library/ms526223(EXCHG.10).aspx
If you're running Exchange 2007 then you can use Transport Rules:
http://msexchangeteam.com/archive/2006/12/12/431879.aspx
http://www.msexchange.org/tutorials/Using-Transport-Rules-Creating-Disclaimers-Exchange-Server-2007.html
We used CodeTwo-s Exchange rules for a while on Exchange 2003.
However there is a known problem with it: if the messages stay in the queue for 2-3 minutes, the Exchange itself sends out the message without the footer. Most of the times it's not a problem, but we have something like 700 people in our organization. If there are a lot of emails and some of them contains attachments, then the virus scanner stops them for a while (MS Antigen).
Otherwise it's a perfect solution if you have a smaller group of users to manage.
From other point of view: our users like to have some kind of control over the signature. We generated them and put it to their Outlooks. They like it that they know and see that the signature is there and how it looks like.

Resources