Mail services – setting up Home directory Mail spooling
by
Ted Wisniewski
The reasons to do "Home directory" spooling are many… Here is a couple of really good reasons:
What you will need:
Now that you have the two essential pieces of software we need to extract the files, build and install them.
Procmail –
Sendmail –
Remove the following line:
MAILER(local)dnl
Now, You must tell your mail-readers where the mail is now spooled, most of them assume /var/mail or some other centralized place.
For (using csh or tcsh) "elm" and "mail" they respect the "MAIL" environment variable. You can set it in /etc/csh.cshrc as follows:
setenv MAIL ~/.mail
For pine, you need to edit your system-wide Pine configuration file usually /usr/local/etc/pine.conf and add:
inbox-path=~/.mail
For POP/IMAP mail readers, you will need to download the source for imap-4.4.tar.Z from ftp.cdrom.com in the /pub/FreeBSD/ports/distfiles directory.
Extract the archive: tar zxvf imap-4.4.tar.Z
You need to make 1 modification to imap-4.4/src/osdep/unix/env_unix.c, comment out or remove the line indicated below add/replace that line with
the one provided.
char *sysinbox ()
{
char tmp[MAILTMPLEN];
if (!sysInbox) { /* initialize if first time */
/*sprintf (tmp,"%s/%s",MAILSPOOL,myusername ()); /*REMOVE*/
sprintf (tmp,"%s/%s",myHomeDir,"/.mail"); /*ADD*/
sysInbox = cpystr (tmp); /* system inbox is from mail spool */
}
return sysInbox;
}
Then build the POP3 and IMAP servers by doing "make bsf" in the imap-4.4 directory.
Upon completion of the build do the following as root (I assume you have backed up older versions if you are overwriting older executables):
cp imapd/imapd /usr/local/bin/imapd
chmod 755 /usr/local/bin/imapd
cp ipopd/ipop3d /usr/local/bin/ipopd
chmod 755 /usr/local/bin/ipopd
Now edit /etc/inetd.conf and make sure your pop3 & imap entries appear like:
pop3 stream tcp nowait root /usr/local/bin/ipop3d ipop3d
imap stream tcp nowait root /usr/local/bin/imapd imapd
If /etc/inetd.conf requires editing, you will need to "kill -HUP" the inetd process ("kill -HUP `/var/run/inetd.pid`" )