* Mail: New "Save As" preference option to attach just the mail, no mail attachments

This commit is contained in:
nathangray 2021-01-06 10:04:24 -07:00
parent 85b14052ea
commit 6fec92bf8b
3 changed files with 6 additions and 4 deletions

View File

@ -165,6 +165,7 @@ class mail_hooks
$saveAsOptions = array(
'text_only' => lang('convert only Mail to item (ignore possible attachments)'),
'no_attachments' => lang('add raw message, ignore mail attachments'),
'text' => lang('convert Mail to item and attach its attachments to this item (standard)'),
'add_raw' => lang('convert Mail to item, attach its attachments and add raw message (message/rfc822 (.eml)) as attachment'),
);

View File

@ -149,7 +149,7 @@ class mail_integration {
$sessionLocation = 'mail';
$mailbox = base64_decode($_GET['mailbox']);
if (!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')&&is_array($_attachments))
if (!(in_array($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'],['text_only','no_attachments']))&&is_array($_attachments))
{
// initialize mail open connection requirements
if (!isset($_icServerID)) $_icServerID =& Api\Cache::getSession($sessionLocation,'activeProfileID');
@ -236,7 +236,7 @@ class mail_integration {
}
// this one adds the mail itself (as message/rfc822 (.eml) file) to the app as additional attachment
// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw' &&
if (in_array($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'],['add_raw','no_attachments']) &&
$_rawMail && file_exists($_rawMail))
{
$subject = Mail::clean_subject_for_filename($_subject);
@ -295,10 +295,10 @@ class mail_integration {
$mo->openConnection();
$mo->reopen($mailbox);
try {
$mailcontent = Mail::get_mailcontent($mo,$uid,'',$mailbox,null,true,(!($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='text_only')));
$mailcontent = Mail::get_mailcontent($mo,$uid,'',$mailbox,null,true,(!(in_array($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'],['text_only','no_attachments']))));
// this one adds the mail itself (as message/rfc822 (.eml) file) to the app as additional attachment
// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
if ($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw')
if (in_array($GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions'],['add_raw','no_attachments']))
{
$message = $mo->getMessageRawBody($uid, '',$mailbox);
$headers = $mo->getMessageHeader($uid, '',true,false,$mailbox);

View File

@ -25,6 +25,7 @@ add all my aliases mail en Add all my aliases
add as new mail en Add as new
add files as %1 mail en Add files as %1
add folder mail en Add Folder
add raw message, ignore mail attachments mail en Convert mail to item, add raw message (ignore mail attachments)
add this certificate into contact mail en Add this certificate into contact
add to addressbook mail en add to addressbook
add your domain as "%1" in options to list of email providers and enable api. mail en Add your domain as "%1" in options to list of email providers and enable API.