SOLVED Importing SquirrelMail Address Books to Horde and Roundcube

Nirjonadda

Well-Known Member
May 8, 2013
752
28
78
cPanel Access Level
Root Administrator
---------------------
Moderator Edit Start
We've published the following solution since this post was first created:


Hello Everyone,

Good news! Hosting providers can now install the following plugins in cPanel & WHM version 78:

Importing SquirrelMail Address Books to Roundcube - cPanel Knowledge Base - cPanel Documentation
Importing SquirrelMail Address Books to Horde - cPanel Knowledge Base - cPanel Documentation

These plugins will automatically import a SquirrelMail user's email contact list to their Roundcube or Horde address books. For example, the first time a Roundcube user logs in to their email account after the hosting provider installs the plugin, the system automatically migrates the user's SquirrelMail contacts to Roundcube.

Thank you.

Moderator Edit End
---------------------


SquirrelMail Deprecation and removed SquirrelMail from v76 but this still are showing in cPanel.

ScreenShot00528.png
 
Last edited by a moderator:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
Hi @Nirjonadda


It is still present in v76, we're not shipping it in new installs. I'm waiting on information from the team that was responsible for this change on specifically why or how SquirrelMail is to be removed from existing installs but you can remove SquirrelMail from the UI by removing the SquirrelMail package if you'd like.

Here's what I did:

1. Found the package name:

Code:
rpm -qa |grep squirrel
cpanel-squirrelmail-2012.12.09-4.cp1176.noarch
2. Removed the package:
Code:
rpm -e --nodeps cpanel-squirrelmail-2012.12.09-4.cp1176.noarch
I will update here if a case is opened for SquirrelMail remaining present in the UI
 

sparek-3

Well-Known Member
Aug 10, 2002
2,135
260
388
cPanel Access Level
Root Administrator
Would be nice if there were a way to disable SquirrelMail on a per user (Linux user - cPanel account) level. This way we could begin phasing out SquirrelMail for users and only leave it enabled for users that have not yet migrated their dependence on it.
 
  • Like
Reactions: cPanelLauren

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
I understand what you're saying though, there really isn't a way to do that for other webmail clients either, there's the tweak setting to enable/disable the specific webmail client but no per account way.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,135
260
388
cPanel Access Level
Root Administrator
I understand what you're saying though, there really isn't a way to do that for other webmail clients either, there's the tweak setting to enable/disable the specific webmail client but no per account way.
Indeed. I really thought this was an option in the Feature Manager - but I did not see it there either.

But even if it were in the Feature Manager... that only applies to packages, not users. Which I have never, ever, ever figured out the usefulness there. But that's a dead horse I've been bludgeoning for years.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
Yes, Currently new v76 installations will not have SquirrelMail, while in v78 will be removing it from existing servers when updating to version 78
Yes, I was primarily trying to answer your question. What I am concerned about is that we removed the tweak setting enable/disable switch for SquirrelMail so right now the only way to remove it is to uninstall the package.

But even if it were in the Feature Manager... that only applies to packages, not users. Which I have never, ever, ever figured out the usefulness there.
I do agree that a per-account option for this would be useful - not just for SquirrelMail but for all the webmail clients - it'd be worth a feature request.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,135
260
388
cPanel Access Level
Root Administrator
I do agree that a per-account option for this would be useful - not just for SquirrelMail but for all the webmail clients - it'd be worth a feature request.
It would be beneficial for just about every item listed in the Feature Manager. Want one user to have shell or terminal access? Simply enable it for that user, instead of creating a single-one-time-nobody-else-uses package JUST with shell/terminal for that user to use. Seems pretty stupid to me.

... But I'm veering this thread off-topic and that's not my intent. And I don't do feature requests, I'm a bit soured on their principles.
 

mtindor

Well-Known Member
Sep 14, 2004
1,463
114
193
inside a catfish
cPanel Access Level
Root Administrator
With Squirrelmail going away, obviously one has to notify users and have them choose Horde or Roundcube as default.

1. Once a system is updated to WHM 78 and Squirrelmail is removed, will users who still had Squirrelmail set as their default be automatically redirected back to the screen where they can choose Horde or Roundcube? Or will they get some sort of flaky error until they manually select Roundcube / Horde by clicking on their email address to bring up the the options?

2. Are address books stored in Squirrelmail somehow exported magically and imported into Roundcube and Horde? Or does the customer have to manually export the address book from Squirrelmail and import it into Roundcube and Horde prior to the server being updated to WHM 78?

3. If the customer has to manually export, cPanel should keep in mind that there is no facility in Squirrelmail by default to export Address Book entries. The server admin has to install something like the abook_import_export plugin.

I haven't seen/heard anybody talk about this. But I very much consider it an issue that longtime SQuirrelmail users can have huge address books that will need exported (and they would have no clue). I don't think there has been anything in cPanel's announcements to even suggest to system administrators that this is an issue that a hosting company and its customers are going to have to deal with prior to the servers being updated to WHM 78.

Anyone? thoughts?

mike
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello Mike,

1. Once a system is updated to WHM 78 and Squirrelmail is removed, will users who still had Squirrelmail set as their default be automatically redirected back to the screen where they can choose Horde or Roundcube? Or will they get some sort of flaky error until they manually select Roundcube / Horde by clicking on their email address to bring up the the options?
Webmail access attempts are automatically sent to the Webmail selection page where users can choose between Horde or Roundcube if SquirrelMail was previously enabled as the default Webmail client.

2. Are address books stored in Squirrelmail somehow exported magically and imported into Roundcube and Horde? Or does the customer have to manually export the address book from Squirrelmail and import it into Roundcube and Horde prior to the server being updated to WHM 78?
SquirrelMail configuration and data directories in the end-user's home directory are not removed during the update to version 78, however existing data (e.g. address books) is not automatically imported into Roundcube or Horde. Users will need to manually import their SquirrelMail address books into the new webmail client of their preference.

3. If the customer has to manually export, cPanel should keep in mind that there is no facility in Squirrelmail by default to export Address Book entries. The server admin has to install something like the abook_import_export plugin.

I haven't seen/heard anybody talk about this. But I very much consider it an issue that longtime SQuirrelmail users can have huge address books that will need exported (and they would have no clue). I don't think there has been anything in cPanel's announcements to even suggest to system administrators that this is an issue that a hosting company and its customers are going to have to deal with prior to the servers being updated to WHM 78.
I recommend working with your customers to export any SquirrelMail address books you want moved into Horde/Roundcube before the upgrade to version 78. Here's an example of steps and a manual script you could use to do this:

1. Login via SSH and make a backup of the user's .sqmaildata directory:

Code:
cp -a /home/username/.sqmaildata /home/username/.sqmaildata-backup
2. Browse to a user's .sqmaildata directory:

Code:
cd /home/username/.sqmaildata/
3. Create a file named /home/username/.sqmaildata/address-book-converter.sh with the following contents:

Code:
#!/bin/bash
for x in `ls *.abook`
do

cat $x | while read line
do
echo "BEGIN:VCARD" >> $x.vcf
echo "VERSION:3.0" >> $x.vcf
echo -n "N:" >> $x.vcf
echo -n `echo $line | cut -d'|' -f3` >> $x.vcf
echo -n ";" >> $x.vcf
echo `echo $line | cut -d'|' -f2` >> $x.vcf
echo -n "FN:" >> $x.vcf
echo `echo $line | cut -d'|' -f1` >> $x.vcf
echo -n "EMAIL;TYPE=PREF,INTERNET:" >> $x.vcf
echo `echo $line | cut -d'|' -f4` >> $x.vcf
echo "END:VCARD" >> $x.vcf
echo >> $x.vcf

done

echo "done $x"
done
Source: Linux in My Box: Migrating your squirrel mail contacts to roundcube

4. Set the permissions on this script to 0755:

Code:
chmod 0755 /home/username/.sqmaildata/address-book-converter.sh
5. Run the converter script:

Code:
sh /home/username/.sqmaildata/address-book-converter.sh
This will convert all of the SquirrelMail address book files (.abook) to Vcard (.vcf) format. The .vcf files are importable to Roundcube using Roundcube >> Contacts >> Import.

Additionally, I suggest opening a feature request for a utility that automatically imports SquirrelMail address books into Horde or Roundcube:

Submit A Feature Request

Let me know the feature request URL once it's opened.

Thank you.
 
Last edited:

PeteS

Well-Known Member
Jun 8, 2017
380
85
78
Oregon
cPanel Access Level
Root Administrator
In preparation for V78 and the removal of SM, I need a time line for that release.

If there is not an official one, give me a safe bet guess, but IDK will not be satisfactory. I need to provide users a deadline for migration, particularly of contacts.

Questions:
- when V78 removes it, will all SM files be removed (including contacts)?
- how will legacy webmail application default be handled? (i.e. if they have SM selected as default what will happen on login?)
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
A lot of this I can't answer just yet for you v78 isn't even into edge yet and I don't anticipate it being there until at least the end of December but most likely sometime in January.

If it's necessary as well you can hang on to SquirrelMail this is noted in The Death of SquirrelMail | cPanel Blog

How to keep SquirrelMail after removal
We understand that SquirrelMail’s faithful fans will not welcome this decision, but we have good news! You can continue to use SquirrelMail after version 78 because cPanel & WHM supports custom webmail applications. Follow our documentation on Integrating Custom Webmail Applications, and get the code from the SquirrelMail website. Just a note: it will be the server administrator’s responsibility to keep SquirrelMail up to date if updates are released.
 
  • Like
Reactions: PeteS

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,300
363
Houston
  • Like
Reactions: PeteS

cPanelResources

Staff
Staff member
Apr 27, 2015
112
83
153
Houston, TX
cPanel Access Level
DataCenter Provider
cPanelResources submitted a new resource:

How to convert SquirrelMail address books to Roundcube or Horde - Manually export SquirrelMail address books and import them into Roundcube or Horde.

In April of 2018 we announced the deprecation and removal of SquirrelMail. cPanel version 76 stopped shipping SquirrelMail in new installations. cPanel version 78 removes SquirrelMail completely. More information can be found in this Blog Post.

With this deprecation and removal comes the need to transfer users' address books to either Roundcube or Horde.

Here we'll look at the steps required to export the SquirrelMail address...
Read more about this resource...
 

ramorse

Well-Known Member
Sep 6, 2003
256
5
168
cPanel Access Level
Root Administrator
This worked quite well. However, it apparently does not export extra fields like address and phone. At least one client had a lot of that data in SquirrelMail. Would it be possible to modify the script to export more fields?
 

Gary Barr

Registered
May 5, 2018
3
0
1
Evansville, IN
cPanel Access Level
Root Administrator
We've had a number of customers that didn't listen to our warnings and now that Squirrelmail is gone, they are looking for their contacts. We still have the squirrelmail directory, but when I try to use the script above to convert them into a usable format, I get this message:

sh address-book-converter.sh
address-book-converter.sh: line 3: syntax error near unexpected token `$'do\r''
'ddress-book-converter.sh: line 3: `do

Any ideas on what is wrong?
 

Attachments

PeteS

Well-Known Member
Jun 8, 2017
380
85
78
Oregon
cPanel Access Level
Root Administrator
sh address-book-converter.sh
address-book-converter.sh: line 3: syntax error near unexpected token `$'do\r''
'ddress-book-converter.sh: line 3: `do

Any ideas on what is wrong?
Have you checked the file you created for errors? I know I used that script previously and it works as described. Try recreating the file?

FWIW, this is what I finally used to create all export files in one shot. (I didn't use the send to user via email script, though.)

-Pete
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
sh address-book-converter.sh
address-book-converter.sh: line 3: syntax error near unexpected token `$'do\r''
'ddress-book-converter.sh: line 3: `do
Hello @Gary Barr,

It looks like the .sh file may have improper syntax. Can you check that the script is formatted correctly after you copied/pasted the code?

Also, there's a community script (referenced on the feature request) available on the following GitHub page you may want to try instead:

loweryaustin/cpanel-squirrelmail-exporter

Can you let me know if this script is more useful?

Thank you.
 
Last edited:
  • Like
Reactions: PeteS