Exchange 2007 NDRs to public Folders
Q1。您必須將其更改爲multipart/alternative,但也應該找到「Content-Type:message/delivery-status」並將其更改爲text/plain,但並非必需
Q2。你可以做到這一點,但你唯一的選擇「原始」的消息是拒絕它的發件人,隔離或允許它..沒有刪除/下拉選項..但因爲它是去公用文件夾它將被丟棄。
如果你去那麼這條路枚舉EndOfHeadersEvent在標題和正文,然後生成一個新的對象MAILMESSAGE,包括從原來的
Q3的標題和正文。這應該工作..只有理由,我可以看到它不會工作是如果你想發送到外部收件人/域不是服務器上的接受域..如果這是你想要做的,那麼你'需要創建一個郵件聯繫人與您的真實外部地址,然後抄送到外部聯繫人的NDR
以下是我能夠完成你想要做的事情的代碼。我掛接到onRcpt和onEndOfHeaders的原因是爲了檢查是否輸入了收件人是公用文件夾address..I發現它的速度比在頭
void UserSendCounterSmtpReceiveAgent_OnRcptCommand(ReceiveCommandEventSource source, RcptCommandEventArgs e)
{
if(source == null || e == null)
{
return;
}
String recipient = e.RecipientAddress.ToString();
if (recipient.Equals("[email protected]"))
{
this.testOnEndOfHeaders = true;
}
}
void UserSendCounterAgent_OnEndOfHeaders(ReceiveMessageEventSource source, EndOfHeadersEventArgs e)
{
if (source == null || e == null)
{
return;
}
if (testOnEndOfHeaders)
{
this.testOnEndOfHeaders = false;
Header obj = e.Headers.FindFirst("Content-Type");
if (obj.Value.Equals(@"multipart/report"))
{
obj.Value = @"multipart/alternative";
e.MailItem.Recipients.Add(new RoutingAddress("[email protected]"));
}
}
}
結束枚舉RCPT列表