Feature #61271
solve Failed to read message content for direct ref (for empty ICAL mime data)
0%
Description
solve Failed to read message content for direct ref
if scalix-api.log contains such log entries and it prevents some user to get Calendars
Failed to read message content for direct ref DREF
need to find for Owner of this appointment and folder where it stored
[root@mail]# omdref DREF
for e.g.
[root@mail logs]# omdref 001be6fd4b8ec597 USER FOLDER: Alexey Bobyr / uk, hq/CN=Alexey Bobyr FILING AREA: User 429 Filing Tray : RecNo : ItemNo FOLDER: Calendar : 5 : 830795 MESSAGE: XX-XXXXXXXXXXX : 11 : 19982938 [root@mail logs]#
To export one message need to know folder-id for sxmboxexp command
sxmboxlist -u 'USER'
[root@mail logs]# sxmboxlist -u 'Alexey Bobyr / uk, hq/CN=Alexey Bobyr' # Archive contents : Alexey Bobyr # Archive date : 2019-01-29 00:49:03 F-0000000001 Inbox F-0001868224 Inbox/SPAM F-0000000002 Outbox F-0000000003 Sent Items F-0000830790 Deleted Items F-0000830795 Calendar F-0000830796 Contacts F-0000830797 Drafts F-0000830798 Notes F-0000830799 Tasks F-0002360804 Sent F-0008531139 Sent Messages F-0009124183 Trash F-0009173245 sdfdsfdsfdsf F-0012419556 Test F-0015913717 Journal F-0015913718 RSS Feeds F-0015913719 Conversation Action Settings F-0015913720 Quick Step Settings F-0015913725 Junk E-mail F-0018120405 Deleted Items [root@mail]#
Since omdref showed folder Calendar so we need
F-0000830795
since sxmboxlist output
F-0000830795 Calendar
Now lets export item.
sxmboxexp -F -f FOLDER_ID_FROM_MBOXLIST -u 'USER' -d MSG_DREFS -a ./DEST_FILENAME.mbox
[root@mail]# sxmboxexp -F -f F-0000830795 -u 'Alexey Bobyr / uk, hq/CN=Alexey Bobyr' -d 001be6fd4b8ec597 -a ./001be6fd4b8ec597.mbox [root@mail]#
Lets check our mbox file what he contains.
sxmboxlist -a ./ARCHIVE_FILE_NAME.mbox -v m
sxmboxlist -a ./001be6fd4b8ec597.mbox -v m # Archive file : ./001be6fd4b8ec597.mbox # Archive contents : Alexey Bobyr # Archive date : 2019-01-29 00:51:55 F-0000830795 Calendar M-0019982938 XX-XXXXXXXXXXX 2018-04-26 08:55:28 XXXXXXXXXX
Lets delete message. First lets ensure that we will delete only one email
omtidyu -B -u 'USER' -l 'Calendar' -T f -t "SUBJECT_FROM_ONDREF"
[root@mail]# omtidyu -B -u 'Alexey Bobyr / uk, hq/CN=Alexey Bobyr' -l 'Calendar' -T f -t "XX-XXXXXXXXXXX" Deletable items for 'Alexey Bobyr /uk,hq/CN=Alexey Bobyr' Folder 'Calendar': 1 items
to delete item need to add '-d' option
[root@mail]# omtidyu -B -u 'Alexey Bobyr / uk, hq/CN=Alexey Bobyr' -l 'Calendar' -T f -t "XX-XXXXXXXXXXX" -d Items moved to the WasteBasket for 'Alexey Bobyr /uk,hq/CN=Alexey Bobyr' Folder 'Calendar': 1 items [root@mail]#
import
[root@mail]# sxmboximp -a ./001be6fd4b8ec597.mbox
History
Updated by Alexey Bobyr almost 2 years ago
- Description updated (diff)
- Target version changed from 12.7.1 to Unspecified
Updated by Alexey Bobyr almost 2 years ago
simple script
#!/bin/bash if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 fi if [ -z "$1" ]; then echo "Please provide msg DREF" 1>&2 exit 2 fi export PATH=/opt/scalix/bin:$PATH msg_data=$(omdref $1) error=$? if test $error -gt 0 then echo "$msg_data" 1>&2 exit $error fi user=$(grep -Po -- 'USER FOLDER: \K(.*)' <<< "$msg_data" | xargs ) folder=$(grep -Po -- ' FOLDER: \K(.*)' <<< "$msg_data" | cut -d':' -f1 | xargs) subject=$(grep -Po -- 'MESSAGE: \K(.*)' <<< "$msg_data" | cut -d':' -f1 | xargs) if [ -z "$user" -o -z "$folder" -o -z "$subject" ]; then echo "Could not determine all data. User '$user' , Folder '$folder', Subject '$subject'" 1>&2 exit 3 fi folder_id=$(sxmboxlist -u "$user" | grep "$folder$" | cut -d' ' -f1 | xargs) if [ -z "$folder_id" -o -z "$folder" -o -z "$subject" ]; then echo "Unable to find folder using sxmboxlist" 1>&2 exit 4 fi mbox_file_name="$(echo $PWD)/$1.mbox" if [ -f "$mbox_file_name" ]; then rm -f "$mbox_file_name" fi echo "Exporting item $1 to a file $mbox_file_name" sxmboxexp -F -f $folder_id -u "$user" -d $1 -a $mbox_file_name echo "Checking mbox" sxmboxlist -a $mbox_file_name -v m omtidyu_cmd="omtidyu -B -u '$user' -l '$folder' -T f -t '$subject'" eval $omtidyu_cmd read -p "Do you whant to delete those msgs ( yes / no ) ?" yn case $yn in [Yy]* ) eval "$omtidyu_cmd -d" ;; [Nn]* ) exit 0 ;; * ) echo "Please answer yes or no.";; esac sxmboximp -a "$mbox_file_name"
Usage/Output
[root@test ~]# ./recreate_email.sh 0001760451d6f6d7 Exporting item 0001760451d6f6d7 to a file /root/0001760451d6f6d7.mbox Checking mbox # Archive file : /root/0001760451d6f6d7.mbox # Archive contents : firstname sxadmin # Archive date : 2019-01-29 02:35:58 F-0000254613 Calendar M-0000288274 sdfasdasdasdas 2018-11-09 12:08:37 firstname sxadmin Deletable items for 'firstname m. sxadmin s. /test/CN=firstname sxadmin' Folder 'Calendar': 1 items Do you whant to delete those msgs ( yes / no ) ?y Items moved to the WasteBasket for 'firstname m. sxadmin s. /test/CN=firstname sxadmin' Folder 'Calendar': 1 items You have new mail in /var/spool/mail/root [root@test ~]#
Updated by Alexey Bobyr almost 2 years ago
- Subject changed from solve Failed to read message content for direct ref to solve Failed to read message content for direct ref (for empty ICAL mime data)