瀏覽代碼

- Keep track of the object at the source of any email notification for further correlation (either in the user's mailbox or for automatic processing of incoming emails)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@943 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 14 年之前
父節點
當前提交
9dbcaff50c
共有 2 個文件被更改,包括 14 次插入2 次删除
  1. 8 1
      core/action.class.inc.php
  2. 6 1
      core/email.class.inc.php

+ 8 - 1
core/action.class.inc.php

@@ -235,6 +235,10 @@ class ActionEmail extends ActionNotification
 	
 			$sSubject = MetaModel::ApplyParams($this->Get('subject'), $aContextArgs);
 			$sBody = MetaModel::ApplyParams($this->Get('body'), $aContextArgs);
+			
+			$oObj = $aContextArgs['this->object()'];
+			$sServerIP = gethostbyname(gethostname());
+			$sReference = '<iTop/'.get_class($oObj).'/'.$oObj->GetKey().'@'.$sServerIP.'>';
 
 			$oEmail = new EMail();
 
@@ -251,12 +255,14 @@ class ActionEmail extends ActionNotification
 				$sTestBody .= "<li>BCC: $sBCC</li>\n";
 				$sTestBody .= "<li>From: $sFrom</li>\n";
 				$sTestBody .= "<li>Reply-To: $sReplyTo</li>\n";
+				$sTestBody .= "<li>References: $sReference</li>\n";
 				$sTestBody .= "</ul>\n";
 				$sTestBody .= "</p>\n";
 				$sTestBody .= "</div>\n";
 				$oEmail->SetBody($sTestBody);
 				$oEmail->SetRecipientTO($this->Get('test_recipient'));
 				$oEmail->SetRecipientFrom($this->Get('test_recipient'));
+				$oEmail->SetReferences($sReference);
 			}
 			else
 			{
@@ -267,6 +273,7 @@ class ActionEmail extends ActionNotification
 				$oEmail->SetRecipientBCC($sBCC);
 				$oEmail->SetRecipientFrom($sFrom);
 				$oEmail->SetRecipientReplyTo($sReplyTo);
+				$oEmail->SetReferences($sReference);
 			}
 	
 			if (empty($this->m_aMailErrors))
@@ -339,4 +346,4 @@ class ActionEmail extends ActionNotification
 		}
 	}
 }
-?>
+?>

+ 6 - 1
core/email.class.inc.php

@@ -89,6 +89,11 @@ class EMail
 			$this->m_aHeaders[$sKey] = $sValue;
 		}
 	}
+	
+	public function SetReferences($sReferences)
+	{
+		$this->AddToHeader('References', $sReferences);
+	}
 
 	public function SetBody($sBody)
 	{
@@ -132,4 +137,4 @@ class EMail
 
 }
 
-?>
+?>