Merged some enhancements fro the trunk to better keep track of sent emails

SVN:1.2[1634]
This commit is contained in:
Denis Flaven
2011-10-13 15:42:59 +00:00
parent 9e732d6045
commit 1683ca2dd6
2 changed files with 13 additions and 4 deletions

View File

@@ -275,6 +275,7 @@ class ActionEmail extends ActionNotification
protected function _DoExecute($oTrigger, $aContextArgs, &$oLog)
{
$sPreviousUrlMaker = ApplicationContext::SetUrlMakerClass();
$aHeaders = array();
try
{
$this->m_iRecipients = 0;
@@ -294,7 +295,9 @@ class ActionEmail extends ActionNotification
$sBody = MetaModel::ApplyParams($this->Get('body'), $aContextArgs);
$oObj = $aContextArgs['this->object()'];
$sReference = '<iTop/'.get_class($oObj).'/'.$oObj->GetKey().'>';
$sMessageId = sprintf('<iTop_%s_%d_%f@%s.openitop.org>', get_class($oObj), $oObj->GetKey(), microtime(true /* get as float*/), MetaModel::GetConfig()->Get('session_name'));
$sReference = $sMessageId;
$aHeaders['Message-ID'] = $sMessageId;
}
catch(Exception $e)
{
@@ -315,7 +318,7 @@ class ActionEmail extends ActionNotification
if (isset($sBody)) $oLog->Set('body', $sBody);
}
$oEmail = new EMail();
$oEmail = new EMail('', '', '', $aHeaders);
if ($this->IsBeingTested())
{

View File

@@ -73,8 +73,14 @@ class EMail
{
$sHeaders = 'MIME-Version: 1.0' . "\r\n";
// ! the case is important for MS-Outlook
$sHeaders .= 'Content-Type: text/html; charset=UTF-8' . "\r\n";
$sHeaders .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
if (!array_key_exists('Content-Type', $this->m_aHeaders))
{
$sHeaders .= 'Content-Type: text/html; charset=UTF-8' . "\r\n";
}
if (!array_key_exists('Content-Transfer-Encoding', $this->m_aHeaders))
{
$sHeaders .= 'Content-Transfer-Encoding: 8bit' . "\r\n";
}
foreach ($this->m_aHeaders as $sKey => $sValue)
{
$sHeaders .= "$sKey: $sValue\r\n";