Wednesday, May 13, 2020

Mobile skin and plugin for Roundcube webmail

The "Melanie2" mobile skin and plugin seems to make Roundcube work on phones. And it is easier to install than it would seem when only briefly looking at the github instructions.

These are the commands I needed on a Debian 10 ("Buster") machine where roundcube 1.3.10 was installed. (the base install was done from the Debian repositories: apt install roundcube roundcube-sqlite3. Instead of sqlite3, it is also possible to use PostgreSQL or MySQL with the roundcube-pgsql or roundcube-mysql packages).

For the mobile stuff:

Create a directory to store the extra stuff and make upgrades easier:

mkdir -p /opt/roundcube-stuff
cd /opt/roundcube-stuff/

Get the files from Github:

git clone https://github.com/messagerie-melanie2/roundcube_skin_melanie2_larry_mobile
git clone https://github.com/messagerie-melanie2/roundcube_jquery_mobile
git clone https://github.com/messagerie-melanie2/roundcube_mobile

Instead of renaming and copying the directories, create symlinks and copy them to roundcube's skins and plugins folders:

ln -si $(pwd)/roundcube_skin_melanie2_larry_mobile/ melanie2_larry_mobile
ln -si $(pwd)/roundcube_jquery_mobile/              jquery_mobile
ln -si $(pwd)/roundcube_mobile                      mobile

cp -vd /opt/roundcube-stuff/melanie2_larry_mobile   /var/lib/roundcube/skins/
cp -vd /opt/roundcube-stuff/jquery_mobile           /var/lib/roundcube/plugins/
cp -vd /opt/roundcube-stuff/mobile                  /var/lib/roundcube/plugins/

Finally, add 'mobile' to the $config['plugins'] array in /etc/roundcube/config.inc.php. If doing it by hand is too much work, copy/pasting this should work:

echo 'array_push( $config["plugins"], "mobile" );' | tee -a /etc/roundcube/config.inc.php
#or:
## echo '$config["plugins"][] = "mobile";' | tee -a /etc/roundcube/config.inc.php

Labels: , , , , ,

Saturday, November 20, 2010

Moving IMAP Maildir to another user

A little recipe to move a user's IMAP mails to another user. (Tested on the Courier IMAP server on Debian).

Useful in situations like John leaving the company and Bob needing to have access to John's old emails.

olduser=john; newuser=bob
maildirmake -f $olduser /home/$newuser/Maildir/
cd /home/$olduser/Maildir/
for d in * ; do \
    cp -pr "$d" "/home/$newuser/Maildir/.$olduser/"; \
done
echo "INBOX.$olduser"  >>/home/$newuser/Maildir/courierimapsubscribed
for d in .??*; do \
    cp -pr "$d" "/home/$newuser/Maildir/.$olduser$d"; \
    echo "INBOX.$olduser$d" >>/home/$newuser/Maildir/courierimapsubscribed; \
done
chown -R $newuser /home/$newuser/Maildir

(Beware that if John had a folder with a one-letter name, that one will not be copied. It's because "for d in .*" would do a mess trying to copy "." and "..". So line 6 uses "for d in .??*" instead.)

Labels: , , , , , , ,

Friday, January 01, 2010

Open mbox file in Thunderbird

Unfortunately, there seems to be no straightforward way to ask Thunderbird to open or import an Mbox mail file directly.

Say you have an mbox file, and would like to view it in Thunderbird. For this example, we will view the file in a "temp-mbox" folder under Thunderbird's "Local Folders". The convoluted way which seems to work goes like this:

  • In Thunderbird, under Local Folders, create the new "temp-mbox" folder.
  • Exit Thunderbird.
  • Find your "Local Folders" directory in your profile. It may be something like "~/.thunderbird/random-string.default/Mail/Local Folders/". In there, you will find a temp-mbox and a temp-mbox.msf file.
  • Overwrite temp-mbox with your mbox file,
  • and delete the temp-mbox.msf index file.
  • Re-open Thunderbird
I needed to do this, because of another limitation of Thunderbird: it's poor search capabilities. Since the mails I wanted to group are on my own IMAP server, I did the search there, and put all the mails into a single file. What I wanted is all the last year's emails received from or sent to somedomain. The following got me a suitable mbox file:
mbox=somedomain-2009.mbox; search=@somedomain; \
find ~/Maildir/cur ~/Maildir/.Sent/cur -mtime -365 | \
while read f ; do \
if egrep "^(From|To|Cc):.*$search" "$f"; then \
  echo "From - " >>$mbox; \
  cat "$f" >>$mbox; \
fi; \
done
To achieve this using the TB search, I would have needed to:
  • Search Inbox without subfolders for "From contains @somedomain" or "To contains @somedomain" or "Cc contains @somedomain". This also searches previous years, and takes quite a while on my IMAP folder.
  • Save the search
  • Search Sent for "To contains @somedomain" or "Cc contains @somedomain".
  • Save the search
  • Create a folder for results
  • Open the first saved search folders, sort by date, and copy the 2009 mails to the new results folder
  • Repeat with the second saved search.

Labels: , , , , ,

Monday, September 10, 2007

importing Eudora address books into Thunderbird

The solution to "Can't import empty address book".

The import of Eudora address books into Thunderbird (as of version 2.0.0.6) requires a registry entry pointing to the Eudora data folder.

Put the text below into a text file, adjust the path, save as "EudoraAB-to-TB.reg" or whatever.reg and double-click it. The import should now work, whether you have Eudora installed or not.
Windows Registry Editor Version 5.00

; Adjust C:\\Path\\To\\Folder below so that it points to your Eudora data folder
; with your nndbase.txt and nndbase.toc files and/or your Nickname sub-folder

[HKEY_CURRENT_USER\Software\Qualcomm\Eudora\CommandLine]
"Current"="Anything C:\\Path\\To\\Folder Anything"

The path is normally the path to your Eudora data directory, which contains your .mbx files, your eudora.ini, etc. However, all you really need to have there are your address book files: either nndbase.txt and nndbase.toc, or a sub-folder called "Nicknames" which would have other .txt and .toc address book files, or both the nndbase files and files in the Nicknames folder.

Without this registry entry, you get the standard Windows braindead browse for folder dialog. But whatever you select in that dialog, Thunderbird ignores it and the import just fails with a stupid and misleading message saying "Can't import empty address book". With the registry setting it works, even if the folder contains nothing but the address book files and you don't even have Eudora installed on the machine.

Update: This problem has since been reported in Mozilla bugs (bug 395808). However, the similar registry entry provided didn't work for me when I tried it because it lacked the third word after the path. You really need 3 words in that registry value. The first and the last can be anything, and the path in the middle must of course be correct.

If it still doesn't work, see also bug 368634 (Unable to import if Eudora is using '.nnt' format).

Labels: , , , ,

Friday, July 06, 2007

Why Out-of-office auto-replies should be avoided

Why "Out-of-office" or "vacation" auto-replies should be avoided:
  1. They are useless: if I get an Out-of-office reply instead of the reply I expected, well, that is not a reply. It's useless and is just one more mail I have to delete along with all the spam.
  2. Email is not supposed to be instant communication. For that, there is Instant Messaging or the telephone, or even the fax. The whole point of email is to have asynchronous communication: people can write and respond whenever it is convenient for them.
    When I send an email to someone, I don't expect an immediate reply. I expect to get a reply when my corespondent finds the time. If I can't wait, I use the phone.
  3. If some of your correspondents really need fast replies to emails, then don't frustrate them with useless junk mail. Instead, give them what they want: a real reply. If you cannot read and answer your mail daily, then ask someone else to monitor that account for you while you are away.
  4. Auto-replies occasionally create mailbombs, annoying countless users who never heard of you before.
  5. They confirm your email address to spammers, making sure it stays in their databases
If you really still want to use an auto-responder, here is a link to good auto-reply examples which I hope will help you compose your own out-of-office message.

Labels: , ,

Tuesday, July 04, 2006

Liens email dans les pages web

J'ai eu un peu de mal à retrouver ce lien, alors je suppose que ça vaut la peine de l'inclure dans un petit article de blog. (Finalement, mon attention a été détournée par de nombreux à-côtés; les liens pertinents sont dans les tout derniers paragraphes).

Bien qu'on puisse considérer que la lutte anti-spam s'apparente à un ré-arrangement des transats sur le pont du Titanic, il faut quand même encore mettre des liens email dans des pages web. Là, bien sûr, ils sont immédiatement collectés pour servir à nous inonder de "pourriels", comme disent les français.

Comment avoir des liens "mailto:" cliquables, sans que tous les robots de spam en profitent? Les trucs simples comme "user [at] example [dot] com", ou les plus compréhensibles mais très peu pratiques images montrant le texte de l'adresse ne sont pas cliquables. N'essayez même pas les vieux trucs avec les entités HTML (@ pour "@" etc.); ça fait longtemps que ça ne marche plus. Il n'existe plus guère de robot qui s'y prenne les pieds.

Ce qui marche bien est le javascript, que les robots collecteurs d'adresse ne décodent pas; du moins pas encore, à ma connaissance. Mais la plupart de ces astuces javascript qu'on trouve sur le web utilisent un chiffrage antique (littéralement), et même pas sa version ROT13, mais un décalage de 1. Etant donné qu'une simple expression Perl comme s/(.)/chr(ord($1)-1)/eg; permet de le décoder, je doute que ça résiste longtemps. Tiens pendant que j'y suis, voilà un script Perl complet qui suffit pour extraire d'une page web les emails cryptés de cette façon (quel que soit le décalage utilisé):
use LWP::Simple;
my $url = shift or die "Usage: $0 URL\n";
my $html = get($url);

while ( $html =~ /href=['"]javascript:.*?\(['"](.*?)['"]\)/g ) {
my $crypted = $1;
foreach my $i (-25..25) {
my $try = $crypted;
$try =~ s/(.)/chr(ord($1)+$i)/eg;
if ($try =~ /@([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,6}/) {
print "$try (i=$i)\n";
}
}
}

Bref, je cherchais un peu mieux que ça.

Un certain Jim à qui on essayait de vendre un de ces scripts minables a poussé la solution javascript usuelle (autre exemple ici) à un niveau de cryptage un peu plus actuel. Avec Email Protector, il fournit une page où on peut crypter son adresse email. Il n'y a plus qu'à copier le code fourni aux bons endroits, après avoir séparé du code le lien mailto: lui-même et les fonctions javascript aux noms "obfusqués" et pittoresques. Certains trouveront cette solution exagérée, mais justement, je trouve aussi un certain charme là où d'autres ne verront que du "over-engineered".

Update: Finalement, j'utilise ça régulièrement, et mes suis même adapté le cryptage des adresses en un petit script Perl (disponible ici en .pl et en .bat), pour pouvoir l'utiliser directement à la ligne de commande et obtenir la partie à coller dans le HTML:

#mailcrypt 11 31 [email protected]
<!-- crypted email link -->
<a href="javascript:var N=341,D=43;bid('127 300 95 104 4 95 263 202 318 7 147 95 271 99 133 318',N,D)"
title="Click to send email"
class="mail"<Email</a>

Au préalable, il faut évidemment ajouter
<script type="text/javascript" src="/http/bahut.alma.ch/js/emailProtector.js"></script> dans la page, et sauver l'excellent script de Jim Tucek.

Labels: , , , , , ,