2

Exchange Server の開発に取り組むのはこれが初めてです。以下は、私が使用している単純なトランスポート エージェントです。このエージェントは、以下のコードに示すように、電子メールの件名を更新するだけです。

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;
        }
    }
}

以下は、エージェントのインストールに使用している Powershell スクリプトです。

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

Exchange 管理シェルを使用してエージェントが正常にインストールされました。

交換でメールを送受信すると、メールの件名は変更されません。メールには元の件名があります。どうしてか分かりません?

また、以下のリンクに記載されている手順を実行してエージェントをデバッグしましたが、ブレークポイントが Visual Studio Debugger によってヒットされません。

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

MS Exchange 2007 トランスポート エージェントのデバッグ

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

私のシステム構成

以下のリンクから Microsoft が提供する Exchange Server 2007 仮想マシンを使用しています。

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

また、デバッグ用に Visual Studio 2008 を VM にインストールしました。

問題を解決するために私を助けてください?

4

1 に答える 1