C # scambio Transport Agent 2007
-
25-09-2019 - |
Domanda
Nel tentativo di scrivere un agente di trasporto di scambio che controlla se l'oggetto è vuoto, se è quello che inserisce un oggetto predefinito. ogni volta che ho compilato, installato e attivato questa DLL il server non sarebbe più via e-mail ...
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);
}
}
}
}
Qualcuno sa perché questo non potrebbe essere al lavoro?
grazie
Soluzione
"EventLog.WriteEntry" buttare un errore forse. Ho avuto lo stesso problema e quando rimuova "EventLog.WriteEntry" tutto era ok. Per ora non so perché.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow