質問

イムは、それがデフォルトの件名行を挿入するよりも、ある場合は件名行は、空の場合のテストが見るためにすることを交換輸送エージェントを記述しようとしています。いつでも私は、コンパイルインストール、およびDLLサーバーだろうもはやルート電子メール...

これを有効に
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Microsoft.Exchange.Data.Transport;
using Microsoft.Exchange.Data.Transport.Email;
using Microsoft.Exchange.Data.Transport.Smtp;
using Microsoft.Exchange.Data.Transport.Routing;
using Microsoft.Exchange.Data.Common;

namespace ExchangeTransportAgent
{
    public class RoutingFactory : RoutingAgentFactory
    {

        public override RoutingAgent CreateAgent(SmtpServer server)
        {
            RoutingAgent myAgent = new sRoutingAgent();
            return myAgent;
        }
    }
}




class sRoutingAgent : RoutingAgent
{

    public sRoutingAgent()
    {
        //subscribe to different events
        base.OnSubmittedMessage += new SubmittedMessageEventHandler(SRoutingAgent_OnSubmittedMessage);
    }

    void SRoutingAgent_OnSubmittedMessage(SubmittedMessageEventSource source, QueuedMessageEventArgs e)
    {
        if (e.MailItem.Message.Subject == string.Empty)
        {
            try
            {
                e.MailItem.Message.Subject = "Kranichs Jewelers";


                EventLog.WriteEntry("MY Exchange Routing Agent", "MY ROUTING AGENT CHANGED THE SUBJECT",
                EventLogEntryType.Information, 1337);
            }
            catch (Exception except)
            {
                EventLog.WriteEntry("MY Exchange Routing Agent", except.Message,
                    EventLogEntryType.Error);
            }
        }
    }

}
誰のノウハウを行い、なぜこれを働いていない可能性があります?

感謝

役に立ちましたか?

解決

"EventLog.WriteEntry" 多分エラーをスローします。私は同じ問題を抱えていたと削除「EventLog.WriteEntry」すべてがOKでした。今の私にはわからない理由ます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top