Archive for November 2008


Flaming Lips New Years Eve Freakout #2 – Dec 31 2008, OKC

November 14th, 2008 — 11:37 am

This is definitely a show you do not want to miss. I was lucky enough to attend the show last year and was blown away. Tickets go on sale tomorrow, Nov 15, at noon central time. You can visit Ticketmaster for info.

Comment » | Music

Exchange Transport Agent – Modifying subject line – Part 1

November 10th, 2008 — 02:14 pm

Recently I had the task of building a transport agent for MS Exchange 2007 that reads each incoming e-mail, looks for a specific string, and modifies the original subject if the string is found.  I used c# in .net 2.0 to accomplish this task with only a few lines of code.  I will do my best to walk you through the steps to accomplish looking at each e-mail that is received in Exchange.

In VS 2005 or 2008 create a Class Library solution type.

You will need to reference the following assemblies from the Exchange Server:

Microsoft.Exchange.Data.Common and Microsoft.Exchange.Data.Transport (They are both found at C:\Program Files\Microsoft\Exchange Server\Public)

Create a class file in your solution, for this example I will call my class file Agent.cs.  Inside Agent.cs you will need to write 2 classes, one class, a sealed factory, will inherit from the RoutingAgentFactory class and will need to implement the following method:

CreateAgent(Microsoft.Exchange.Data.Transport.SmtpServer server)

The other class will inherit from the RoutingAgent class and will contain a constructor and an event handler to catch the OnRoutedMessageEvent.  Here is what your constructor will look like assuming my class name is Agent:
Agent{
this.OnRoutedMessage += new RoutedMessageEventHandler(Agent_OnRoutedMessage);
}
and the event handler will contain the code to check the subject line

Agent_OnRoutedMessage(RoutedMessageEventSource source, QueuedMessageEventArgs e){
//add code here, you can access the e-mail message by using e.MailItem
//This line would add the current date to the end of the subject line
e.MailItem.Message.Subject += DateTime.Now.ToString();
}

One final line of code to add goes in the CreateAgent function in the factory class…

override RoutingAgent CreateAgent(Microsoft.Exchange.Data.Transport.SmtpServer server){
return new Agent();
}

Installing the transport only takes a couple of commands using the Exchange Management Shell, I will post instructions soon.

 

 

Comment » | Development

Working title production

November 10th, 2008 — 01:10 pm

Check out my Portfolio of sites for new projects I am currently working on.  I will be posting updated links soon.

Comment » | Uncategorized