Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Exchange Server 2007 Transport Agent Issue

$
0
0

This is the first time i am working on Exchange Server Development. Below is a simple Transport Agent that i am using, this agent should simply update the email Subjects as shown below in the code.

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Exchange.Data.Transport;
using Microsoft.Exchange.Data.Transport.Smtp;


namespace MyAgents
{
    public sealed class MyAgentFactory : SmtpReceiveAgentFactory
    {
        public override SmtpReceiveAgent CreateAgent(SmtpServer server)
        {
            return new MyAgent();
        }
    }
    public class MyAgent : SmtpReceiveAgent
    {
        public MyAgent()
        {
            this.OnEndOfData += new EndOfDataEventHandler(MyEndOfDataHandler);
        }
        private void MyEndOfDataHandler(ReceiveMessageEventSource source, EndOfDataEventArgs e)
        {
            e.MailItem.Message.Subject = "This message passed through my agent: " + e.MailItem.Message.Subject;
        }
    }
}

Below is the Powershell script i am using to install the Agent.

Net Stop MSExchangeTransport
Install-TransportAgent -Name MyAgent -AssemblyPath EmailLogger.dll -TransportAgentFactory MyAgents.MyAgentFactory
Enable-TransportAgent -Identity MyAgent
Net Start MSExchangeTransport

Agent installed successfully using Exchange Management Shell.

Now when i send/receive emails in exchange, Email subjects are not modified. Emails have their original subjects. I don't know why?

I also performed the steps mentioned in below links to debug the Agent but breakpoints are not being hit by Visual Studio Debugger.

sf-tools.net/Messaging/tabid/55/EntryId/163/Exchange-2010-Transport-Agent.aspx

stackoverflow.com/questions/12347123/debugging-ms-exchange-2007-transport-agent

omarjames.com/blog/index.php/debugging-exchange-transport-agent/

My System Configuration

I am using the Exchange Server 2007 Virtual Machine provided by Microsoft from link below

microsoft.com/en-pk/download/details.aspx?id=14901

I also installed the Visual Studio 2008 on the VM for debugging.

Please help me in resolving the issue?



Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>