-------------------------------------------------------
Rediffmail autologin shell script
-------------------------------------------------------
Author: Bobby Maisnam [ bobby@maisnam.com ]
Created: 5:53 AM 5/15/2005
Last Updated: 5:55 AM 5/15/2005
Version: 0.1
URL: http://blog.maisnam.com/archives/000155.php
-------------------------------------------------------

Download code: http://maisnam.com/code/src/rediffmail_autologin/0.1/0.1.zip (3 kb zipped file)

Rediffmail [http://www.rediffmail.com/] has a 30 day login policy. This means that, if a user does not login at least once over a period of 30 days, email delivery to the account is stopped. Also, if the user does not login over a period of 45 days, all existing emails are deleted. I have access to 5 or 6 rediffmail accounts and I frequently use only 1 or 2 of these. I got the 30-day warning in 2 of my accounts sometime back. Since then, I have made it a point to login to all my accounts at least once in two weeks. This was very inconvenient for me and so I decided to write a script to auto-login into my rediffmail email accounts so that I do not lose my emails due to the 30/45 day login policy.

Note: To use this script, you need to have shell access to a Unix/Linux machine.

[1] File 1: login.sh (the shell script)
lynx -dump -post_data http://mail.rediff.com/cgi-bin/login.cgi < /home/maisnam/cron/rediff/myemail1.txt
lynx -dump -post_data http://mail.rediff.com/cgi-bin/login.cgi < /home/maisnam/cron/rediff/myemail2.txt
lynx -dump -post_data http://mail.rediff.com/cgi-bin/login.cgi < /home/maisnam/cron/rediff/myemail3.txt



[2a] File 2a: myemail1.txt
FormName=existing&login=myemail1&passwd=mypassword1

[2b] File 2b: myemail2.txt
FormName=existing&login=myemail2&passwd=mypassword2

[2c] File 2c: myemail3.txt
FormName=existing&login=myemail3&passwd=mypassword3

In the above example, I have 3 email accounts - myemail1@rediffmail.com, myemail2@rediffmail.com and myemail3@rediffmail.com. Their username and password information is stored in 3 files: myemail1.txt, myemail2.txt and myemail3.txt. The shell script reads in the information from each file and passes them to the login script as a POST entry. The output (which is currently pushed to /dev/null) would be the text-only(lynx) view of the inbox screen for each email account.



[3] Add to crontab
The shell script in [1] has to be executed periodically by adding an entry to the crontab file. An example crontab entry would look like this:
0 0 * * 2,4,6 sh /home/maisnam/cron/rediff/login.sh > /dev/null 2>&1

In the above case, the script would be executed at 12 am, 3 times every week on Tuesday, Thursday and Saturday.



A sample file structure is here: http://maisnam.com/code/src/rediffmail_autologin/0.1/
The code (zipped file) is available at: http://maisnam.com/code/src/rediffmail_autologin/0.1/0.1.zip (3 kb zipped file)


Useful Links:
- http://www.adminschoice.com/docs/crontab.htm
- http://www.rt.com/man/lynx.1.html
- http://lists.debian.org/debian-devel/1999/08/msg01594.html