Mail Client Configuration
From Iitmlug
Contents |
Intention
This document intends to help set up a mail client in the institute. Now why should I want to set up a mail client? Here's why: century 21 broker properti jual beli sewa rumah Indonesia
- The programmable email filtering / processing capabilities of MDA's like procmail are far more flexible and powerful than any web-based interface.
- Web-based interfaces can't be used to read mail after 1:00 AM due to the LAN downage
- Web-based interfaces are very slow in the institute because of the large amount of traffic and limited bandwidth
- Web-based interfaces do not offer powerful e-mail search capabilities (like regexp).
- Transfer of email is much faster on the Local Area Network than on the internet, owing to which attachments are sent faster
Century 21 Broker Properti Jual Beli Sewa Rumah Indonesia
Summary of Information
Here's SMTP / IMAP information for the institute, for generic configurations. Specific configuration procedures are outlined below.
Outgoing mail (SMTP):
SMTP Server 1: 10.65.0.20 'or' smtp.iitm.ac.in SMTP Server 2: 10.94.0.20 'or' hsmtp.iitm.ac.in Port: 25
Incoming mail (IMAP):
IMAP Server: 10.65.0.11 Port: 143 Authentication Required: Yes SSL: No
What you will need
- An IMAP client (like getmail)
- A Mail Delivery Agent (like procmail)
- A Mail Transport Agent / Mail Submission Agent (like sendmail, exim or POSIX)
- A Mail Client (like mutt, kmail or pine)
Forwarding your mail to SMail
You will be using your SMail account to receive email, so you will need to set up forwarding from your other email accounts (GMail / Yahoo! etc) to your SMail account. Ensure that you remove any already existing forwarders from your SMail account to your other accounts, to prevent a forwarding loop. This is not a bad idea as you may think. You can always archive GMail / Yahoo!'s copy, so that you can read mail even when you are outside the institute.
Two issues with this:
- The spam filter is extremely strict. You should consider bearing the pain and training it for a few days, or make it mild using the web configuration interface at mailx1.iitm.ac.in (Needs proxy to access)
- The SMail inbox has a very small mail capacity limit, so you should keep it clean by constantly checking and deleting mail, else it will bounce back email when full. This is not an issue if you frequently check mail, or put it on a cron job as I do.
Typical Configuration on Debian / Ubuntu
In this example configuration, we'll be using getmail + procmail + exim + mutt. This is intended for Debian / Ubuntu users, but should be easily modifiable for other distributions of Linux (replace apt-get with yum or yast or whatever!).
Step 1: Install all that is required
sudo apt-get install exim4 getmail4 procmail mutt
You will be presented with exim4 configuration. If you are not, or made any mistakes, you can always do a sudo dpkg-reconfigure exim4-config and get this configuration wizard back.
Select the following options to each of the wizard steps:
General type of mail configuration: mail sent by smarthost, received via SMTP or fetchmail System mail name: Leave it at your hostname IP-addresses to listen on: 127.0.0.1 Other destinations for which mail is accepted: Leave it at your hostname Machines to relay mail for: Leave blank IP address of outgoing smarthost: 10.94.0.20 Hide local mail name: Choose whatever you want. I chose 'No' because it is ok for me. Keep number of DNS queries minimal: Choose No Delivery method for local mail: mbox format in /var/mail Split configuration into small files: Choose whatever you want. I chose 'Yes'
By now, you should have successfully set up all the required software. If there are any problems, please do post on the Google Group.
Step 2: Configure getmail
Next, we will need to configure getmail to fetch your email from smail.iitm.ac.in. To do that:
cd mkdir ~/.getmail cd .getmail emacs -nw getmailrc # Replace emacs -nw with your favourite text editor
Enter the following and replace the <...> fields with appropriate data:
[retriever] type = SimpleIMAPRetriever server = smail.iitm.ac.in username = <your smail login> password = <your smail password> [destination] type = MDA_external path = /usr/bin/procmail unixfrom = True user = <your local machine username that you use to login to your system>
Now save and exit.
Step 3: Configure mutt
Now, you have the choice of using either the mbox format of email storage or the Maildir format. mbox refers to all email stored in a single file and Maildir refers to email stored as files under a directory. mbox should be easier to grep and faster, while Maildir is more organized in some sense.
Now copy the sample muttrc file to your home directory. WARNING: If you've configured mutt before, be sure to save a backup of ~/.muttrc and then overwrite.
gunzip -c /usr/share/doc/mutt/examples/sample.muttrc.gz > ~/.muttrc
And modify the details by opening it with your favourite editor. You may want to use Kumar Appaiah's .muttrc which is very well configured in which case you may want to ask for it on the LUG. Essential details that you may have to edit are from address, alternates, realname, folder and inbox.
Step 4: Configure procmail
Procmail is probably the best reason to switch to a mail client from a web interface. This is an extremely flexible and in some sense 'programmable' mail delivery agent. As the name suggests, what it does is to process the mail that getmail fetches and put it into your personal mailboxes. procmail can do a whole lot - it can filter your mail and put them in different mailboxes, process your mail through a filter - so that you could remove HTML or remove annoying advertisement tags from mails, or even run a program best weight loss to parse your email and act on it.
Create a file called .procmailrc in your home directory by invoking your favourite editor (I'm using emacs as an example)
emacs -nw ~/.procmailrc
And enter the following:
SHELL=/bin/bash LOGNAME=<your user name> MAILDIR=<directory where you keep mailboxes, usu. $HOME/Mail> # Should be the same folder you specified in .muttrc :0: # Type the same mailbox name that you used in your .muttrc after "set inbox=" below. This should end with a '/' # for Maildir format, and should not have a terminating '/' for mbox format inbox/ # This is to put mail in the $MAILDIR/inbox/ directory in Maildir format # inbox # This is to put mail in the $MAILDIR/inbox file in mbox format
Now save the file. This is the simplest procmail configuration with no filtering. This delivers all mail received by procmail into the inbox (or whatever you call it)
While the man page has lots of information, I'll describe two common situations here:
1. Filtering email for linuxusers_iitm@googlegroups.com into a Maildir folder called 'iitmlug' :0 # :0 starts a rule. :0: is the terminating rule. And this should occur before that. * ^From.*linuxusers_iitm@googlegroups.com # * <regexp> matches only on mail that matches <regexp> iitmlug/ # Target Maildir = iitmlug/
2. Removing "Junk released by Allow List" from the subject line, added by the Spam Filter sometimes :0 fHh # Rule, to act as a 'f'ilter. grep the 'H'eader for regexp matches and pipe the 'h'eader through the filter * ^Subject.*\[Junk released by Allow List\] # Regexp matching [Junk released by Allow List] in the Subject line | sed 's/\[Junk released by Allow List\]//' # sed acting as a filter, removing the [Junk...] from Subject line.
Step 5: Script to fetch mail
To fetch mail from the server, you will normally need to do something like
getmail -n -d # n for new mail, d for delete from server, q for quiet.
It is usually more convenient to automate this using cron, so that it keeps checking for new mail. In this case, you may want to use the following script: (Contributed by Kumar Appaiah)
#!/bin/sh if ps ax|grep -q [g]etmail;then echo -e; else ping -c 1 10.65.0.11 -w 3 &> /dev/null && getmail -n -d -q &> /dev/null fi
This script ensures that getmail is invoked only when the server is up and no other getmail diet pills processes are in action.

