My ISP provided me 5 free email ID, each with 1 GB size. However, one of the POP3 account has been spammed with over 2500+ spam messages. Getting those entire messages will not just waste my time but bandwidth too.
Sample shell script to delete all emails from POP3 server
So here is small shell script I wrote to get rid of all the messages on your POP server.
[ $# -eq 0 ] && exit 1 || :
echo USER $username
echo PASS $password
for (( j = 1 ; j <= $MAX_MESS; j++ ))
echo DELE $j
First setup your POP3 username and password. Run this script as follows:
$ ./clean.pop3 2500 | telnet pop3.myisp.com 110
Connected to pop3.myisp.com.akadns.net.
Escape character is '^]'.
+OK hello from popgate(2.34.1)
+OK password required.
+OK maildrop ready, 2501 messages (40690358 octets) (40690358 2147483648)
+OK message 1 marked deleted
+OK message 2 marked deleted
+OK message 3 marked deleted
- 2500: Total number of POP3 messages to remove
- telnet pop3.myisp.com 110: Telnet to ISP pop3 server and delete all emails from a POP3 server
If you are on dial-up internet connection this script is handy. If you prefer there is PHP version too .
Almost a year ago, I wrote about Linux MRTG configuration how-to. However, some user seems to confused with MRTG, most users would like to know – how much traffic actually generated by ADSL/Cable service provider on daily and monthly basis.
MRTG is for network monitoring and it can be use to see how much traffic your server or ADSL router actually generated, however it will not tell you how much megabytes or gigabytes the daily traffic was. For all such home user and people having dedicated single Linux box hosted somewhere remote at IDC/ISP there is a tool called vnStat:
- It is a console-base network traffic monitor for Linux (perfect tool for remote Linux box hosted at ISP)
- It keeps a log of daily and monthly network traffic for the selected network interface(s).
- It collects all data from /proc file system it means normal user can monitor traffic (no need to run vnstat as a root user)
- Easy to setup & configure
- Ease of use
Step # 1: Install vnstat
Debian / Ubuntu Linux user can install vnstat using apt-get command, enter:
# apt-get install vnstat
Step # 2: Enable vnstat
Once installed, you need to create a database with the following command:
# vnstat -u -i eth0
- -u :forces a database update for interface or creates the database if it doesnâ€™t exist
- -i eth0 : use to specify interface
Please note that it will start to collect data via cronjob:
0-55/5 * * * * root /usr/bin/vnstat -u
You do not have to install cronjob yourself; it should be automatically configure by apt-get.
Step # 3 View statistics
Display default traffic statistics
Display daily traffic statistics
$ vnstat -d
Display monthly traffic statistics:
$ vnstat -m
Display all time top10 traffic days:
$ vnstat -t
Try help option to get all query options:
$ vnstat --help
Read man page of vnstat for complete options and more information and download vnstat here