Quantcast
Channel: 318 Tech Journal » vCards
Viewing all articles
Browse latest Browse all 2

Converting Kerio Mail Server Contact Objects to vCards from Command Line/Scripts

$
0
0

Kerio MailServer stores all contact items as individual *.eml files. Sometimes you may which to save these items as vCards for use in Address Book or another contact management application.

In order to grab all contacts from a particular user’s Kerio MailServer store and export them to another folder as vCards, you can use the following shell script.

# 1. Define the user’s contacts directory in the Kerio MailServer store.
# yourdomain.com is the email domain.
# username is the Kerio Mailserver account.
KERIO_CONTACTS=’/usr/local/kerio/mailserver/store/mail/yourdomain.com/username/Contacts/#msgs’
#
# 2. Define user account who will own the exported files
# For example: use www if exported to a website or your shortname if using on your local machine.
OWNER=”www”
#
#3. Define Directory to store the exported files
# For Example: Your local documents folder
VCARDS=”/Users/Username/Documents/”
#
# 4. Grab .eml objects and convert
#
# First make a temporary directory
mkdir -p “$VCARDS/temp”
#
# Copy eml objects to temporary directory
cd “$KERIO_CONTACTS”
cp *.eml “$VCARDS/temp”
#
# Loop over contacts and convert
cd “$VCARDS/temp”
for vcard in *.eml
do
sed -e ‘s/.$// ; 1,/^$/ d’ “$VCARDS/${vcard/%eml/vcf}”
done;
#
#Change permissions and remove temp directory
rm -rf “$VCARDS/temp”
chown -R $OWNER “$VCARDS”


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images