# # Extract Photos from Kerio Connect Contacts
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Extract Photos from Kerio Connect Contacts

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.

Some material is very old and may be incorrect today

© May 2019 Anthony Lawrence

I had a request to extract the images from Kerio Connect contacts. I'm not sure what the reason was, but it's simple enough to do, so why not?

Kero contacts are .eml files, but are actually Vcards internally. They contain the image as inline base64. You could convert the files to Vcard format (see Transferring from Kerio Connect to another mail server) and then google for ways to extract images from Vcards, but why go to the extra trouble?

Here's some jpg's extracted by this program:

Images from Kerio eml Contact files

Each jpg is named from the Full Name (FN) in the contact file. I tightened up spaces because I don't like file names with spaces, but that's not strictly necessary.

The script below assumes the "base64" program exists (it does on my Linux and Mac systems) and that it is sitting in a directory containing Kerio Contact .eml files, presumably copied from their real location. It creates the jpg's in the same directory, though that could be easily changed.

The Mac version runs without complaint. The Linux version spits "base64: invalid input" but does create the files - I have no clue why as of yet.

You could use a very similar script to extract from Vcards.

foreach (<*.eml>)  {
 open(MSG, $_);
 while (<MSG>) {
  $name=$_ if /^FN:/;
  $reading++ if $last =~ /^Content-Id: </;
  if ($reading)  {
  push @holding, $_ if not /^--MIME--/;
  last if /^--MIME--/;
 chomp $name;chop $name; # files have dos line endings;
 $name=~s/ //g;
 if (not $name) {
  print "No FN in $file\n";
 print "$name \n" if $reading;
 if ($reading) {
   open(OUT,"|base64 -D -o $name") or print "Error on $file/n";;
   # That's Mac syntax.  On Linux systems, it's base64 -id >$name
   foreach(@holding) {
      print OUT $_;
   close OUT;

If you found something useful today, please consider a small donation.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Extract Photos from Kerio Connect Contacts

Inexpensive and informative Apple related e-books:

Take Control of Parallels Desktop 12

Take Control of iCloud

Photos for Mac: A Take Control Crash Course

Are Your Bits Flipped?

Take Control of Apple Mail, Third Edition

More Articles by © Anthony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs. (Robert Firth)

Linux posts

Troubleshooting posts

This post tagged:

Kerio Connect


Kerio Info

Kerio Pricing

Kerio RSS Feed




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode