sending mail without the “mail” command

Posted in Bash on October 12th, 2006 by gmunteanu

the "mail" command usually comes with nail package, but there are linux systems that do not have it by default.
so, what can you do in this situation in order to send email.

sendmail -bm toWhoEverYouWant@hisDomain.com
To: toWhoEverYouWant@hisDomain.com
Subject: ioio
ioioMessage
.

So you pass the email address twice in order to send the mail. Hitting <Enter> after the . on the last line [the dot should be alone on that line, no spaces, no nothing], the sendmail program sends the message and then exits.

transparent mc with matrix colors plus a feature

Posted in Bash on October 12th, 2006 by gmunteanu

Found this interesting function on the web:

mc ()
{
mkdir -p $HOME/.mc/tmp 2> /dev/null
chmod 700 $HOME/.mc/tmp
MC=$HOME/.mc/tmp/mc-$$
/usr/bin/mc -C "directory=green,default:executable=brightgreen,default:link=brightmagenta,default:stalelink=black,\
default:device=brightblue,default:special=brightred,default:normal=lightgray,default:selected=yellow,\
black:marked=brightyellow,default:markselect=yellow,red:core=cyan,default:editnormal=green,\
default:editbold=brightgreen,default:editmarked=green,black:menu=red,default:menusel=yellow,\
black:menuhot=green,default:menuhotsel=brightgreen,default::gauge=brightred,green:dnormal=brown,\
default:dfocus=red,yellow:input=green,default" -P "$MC"
cd "`cat $MC`"
/bin/rm -f "$MC"
unset MC;
}
put this function into your .bashrc file in your home folder, and re-login. Now, you should have a new great matrix-style mc. after quitting mc, you should find yourself in the folder last visited with mc – that is neat.

Screenshot [transparent mc on a black background in Fluxbox]:

how to remove all your messages from mailq with postsuper

Posted in Bash on October 3rd, 2006 by gmunteanu

say you got 3000 messages in the queue.
you do "# mailq" and see them all.
if you do postsuper -d 232323P443 for each of them you get old before you know it.
here is what I did:

#!/bin/sh
for i in $(mailq | awk '/userWithVirus/ {print $1}'); do
#echo $i
postsuper -d $i
done

In my case a user with Outlook just got infected and the piece of junk in his mail client just started to spamm the world
For your case , replace userWithVirus with whatever the users you have on your system.