I’m not a fan of mass mail but sometimes it’s useful, just imagine that you want to send a email change notice not only to your personal contacts but to everyone you sent/got email from.

There’s a way, it’s a bit time consuming but it works very well (if you have a lot of email like i do it may take a few hours). This command line is meant to search mail in your kail storage dir, it will create you a file called EMAIL_LIST.txt in your home dir.

grep -r “From\: \| To\:” /home/$HOME/.$DESKTOP_SESSION/apps/kmail/* |grep -v “X\-Envelope” | grep “[A-Z0-9._%+-]\@” | tr -s ” ” | sed s/”\””/””/g | cut -d”:” -f 4 | cut -d “<” -f 2 | grep “>” | cut -d “>” -f 1 | grep @ |sort| uniq -u > /home/$HOME/EMAIL_LIST.txt

if you want to run it in your home folder the command line will be:

grep -r “[A-Z0-9._%+-]\@” $HOME/* | tr -s ” ” | sed s/”\””/””/g | cut -d”:” -f 4 | cut -d “<” -f 2 | grep “>” | cut -d “>” -f 1 | grep @ |sort| uniq -u > /home/$HOME/EMAIL_LIST.txt

Cheers and hope it helped