mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-27 02:14:45 +01:00
improvement of import_mail (decode issue), add headerinfo to body while sending (splitting emailaddresses into to/cc/bcc) and preserving identity
This commit is contained in:
parent
71fa59368b
commit
a5a7fcbc66
@ -976,6 +976,8 @@
|
|||||||
#error_log(print_r($identity,true));
|
#error_log(print_r($identity,true));
|
||||||
// create the messages
|
// create the messages
|
||||||
$this->createMessage($mail, $_formData, $identity, $signature);
|
$this->createMessage($mail, $_formData, $identity, $signature);
|
||||||
|
// remember the identity
|
||||||
|
if ($_formData['to_infolog'] == 'on') $fromAddress = $mail->FromName.($mail->FromName?' <':'').$mail->From.($mail->FromName?'>':'');
|
||||||
#print "<pre>". $mail->getMessageHeader() ."</pre><hr><br>";
|
#print "<pre>". $mail->getMessageHeader() ."</pre><hr><br>";
|
||||||
#print "<pre>". $mail->getMessageBody() ."</pre><hr><br>";
|
#print "<pre>". $mail->getMessageBody() ."</pre><hr><br>";
|
||||||
#exit;
|
#exit;
|
||||||
@ -1097,14 +1099,15 @@
|
|||||||
//error_log(print_r($this->sessionData['bcc'],true));
|
//error_log(print_r($this->sessionData['bcc'],true));
|
||||||
if (is_array($this->sessionData['to']))
|
if (is_array($this->sessionData['to']))
|
||||||
{
|
{
|
||||||
$mailaddresses = $this->sessionData['to'];
|
$mailaddresses['to'] = $this->sessionData['to'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mailaddresses = array();
|
$mailaddresses = array();
|
||||||
}
|
}
|
||||||
if (is_array($this->sessionData['cc'])) $mailaddresses = array_merge($mailaddresses,$this->sessionData['cc']);
|
if (is_array($this->sessionData['cc'])) $mailaddresses['cc'] = $this->sessionData['cc'];
|
||||||
if (is_array($this->sessionData['bcc'])) $mailaddresses = array_merge($mailaddresses,$this->sessionData['bcc']);
|
if (is_array($this->sessionData['bcc'])) $mailaddresses['bcc'] = $this->sessionData['bcc'];
|
||||||
|
if (!empty($mailaddresses)) $mailaddresses['from'] = $fromAddress;
|
||||||
// attention: we dont return from infolog. cleanups will be done there.
|
// attention: we dont return from infolog. cleanups will be done there.
|
||||||
if ($_formData['to_infolog'] == 'on') {
|
if ($_formData['to_infolog'] == 'on') {
|
||||||
$uiinfolog =& CreateObject('infolog.infolog_ui');
|
$uiinfolog =& CreateObject('infolog.infolog_ui');
|
||||||
|
@ -1496,7 +1496,8 @@ class infolog_ui
|
|||||||
//echo __METHOD__.'<br>';
|
//echo __METHOD__.'<br>';
|
||||||
//_debug_array($_attachments);
|
//_debug_array($_attachments);
|
||||||
$bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
|
$bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
|
||||||
$bopreferences = CreateObject('felamimail.bopreferences');
|
$bopreferences =& $this->bofelamimail->bopreferences; //= CreateObject('felamimail.bopreferences');
|
||||||
|
$preferences = $this->bopreferences->getPreferences();
|
||||||
$bofelamimail->openConnection();
|
$bofelamimail->openConnection();
|
||||||
foreach ($_attachments as $attachment)
|
foreach ($_attachments as $attachment)
|
||||||
{
|
{
|
||||||
@ -1534,17 +1535,26 @@ class infolog_ui
|
|||||||
}
|
}
|
||||||
$bofelamimail->closeConnection();
|
$bofelamimail->closeConnection();
|
||||||
}
|
}
|
||||||
|
//_debug_array($_to_emailAddress);
|
||||||
|
$toaddr = array();
|
||||||
|
foreach(array('to','cc','bcc') as $x) if (is_array($_to_emailAddress[$x]) && !empty($_to_emailAddress[$x])) $toaddr = array_merge($toaddr,$_to_emailAddress[$x]);
|
||||||
|
//_debug_array($preferences);
|
||||||
//_debug_array($attachments);
|
//_debug_array($attachments);
|
||||||
$body = strip_tags($_body);
|
$body = self::createHeaderInfoSection(array('FROM'=>$_to_emailAddress['from'],
|
||||||
|
'TO'=>implode(',',$_to_emailAddress['to']),
|
||||||
|
'CC'=>implode(',',$_to_emailAddress['cc']),
|
||||||
|
'BCC'=>implode(',',$_to_emailAddress['bcc']),
|
||||||
|
'SUBJECT'=>$_subject,
|
||||||
|
'DATE'=>bofelamimail::_strtotime($_date))).strip_tags($_body);
|
||||||
$this->edit($this->bo->import_mail(
|
$this->edit($this->bo->import_mail(
|
||||||
implode(',',$_to_emailAddress),$_subject,$body,$attachments,$_date
|
implode(',',$toaddr),$_subject,$body,$attachments,$_date
|
||||||
));
|
));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elseif ($uid && $mailbox)
|
elseif ($uid && $mailbox)
|
||||||
{
|
{
|
||||||
$bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
|
$bofelamimail = CreateObject('felamimail.bofelamimail',$GLOBALS['egw']->translation->charset());
|
||||||
$bopreferences = CreateObject('felamimail.bopreferences');
|
$bopreferences =& $this->bofelamimail->bopreferences; //= CreateObject('felamimail.bopreferences');
|
||||||
$bofelamimail->openConnection();
|
$bofelamimail->openConnection();
|
||||||
$bofelamimail->reopen($mailbox);
|
$bofelamimail->reopen($mailbox);
|
||||||
|
|
||||||
@ -1570,17 +1580,17 @@ class infolog_ui
|
|||||||
static function get_mailcontent(&$bofelamimail,$uid,$partid='',$mailbox='')
|
static function get_mailcontent(&$bofelamimail,$uid,$partid='',$mailbox='')
|
||||||
{
|
{
|
||||||
//echo __METHOD__." called for $uid,$partid <br>";
|
//echo __METHOD__." called for $uid,$partid <br>";
|
||||||
$headers = $bofelamimail->getMessageHeader($uid,$partid);
|
$headers = $bofelamimail->getMessageHeader($uid,$partid,true);
|
||||||
// dont force retrieval of the textpart, let felamimail preferences decide
|
// dont force retrieval of the textpart, let felamimail preferences decide
|
||||||
$bodyParts = $bofelamimail->getMessageBody($uid,'',$partid);
|
$bodyParts = $bofelamimail->getMessageBody($uid,'',$partid);
|
||||||
$attachments = $bofelamimail->getMessageAttachments($uid,$partid);
|
$attachments = $bofelamimail->getMessageAttachments($uid,$partid);
|
||||||
|
|
||||||
if ($bofelamimail->isSentFolder($mailbox)) $mailaddress = $bofelamimail->decode_header($headers['TO']);
|
if ($bofelamimail->isSentFolder($mailbox)) $mailaddress = $headers['TO'];
|
||||||
elseif (isset($headers['FROM'])) $mailaddress = $bofelamimail->decode_header($headers['FROM']);
|
elseif (isset($headers['FROM'])) $mailaddress = $headers['FROM'];
|
||||||
elseif (isset($headers['SENDER'])) $mailaddress = $bofelamimail->decode_header($headers['SENDER']);
|
elseif (isset($headers['SENDER'])) $mailaddress = $headers['SENDER'];
|
||||||
if (isset($headers['CC'])) $mailaddress .= ','.$headers['CC'];
|
if (isset($headers['CC'])) $mailaddress .= ','.$headers['CC'];
|
||||||
//_debug_array($headers);
|
//_debug_array($headers);
|
||||||
$subject = $bofelamimail->decode_header($headers['SUBJECT']);
|
$subject = $headers['SUBJECT'];
|
||||||
|
|
||||||
$message = self::getdisplayableBody($bofelamimail, $bodyParts);
|
$message = self::getdisplayableBody($bofelamimail, $bodyParts);
|
||||||
$headdata = self::createHeaderInfoSection($headers);
|
$headdata = self::createHeaderInfoSection($headers);
|
||||||
|
Loading…
Reference in New Issue
Block a user