aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/fetchmaildistrib
blob: 00cc19107230abc10071c94d5c23cf42aa140d0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#/bin/bash
#
# fetchmaildistrib --- Distribute central fetchmail knowledge.
#
# The central fetchmail database, /etc/fetchmail, contains all accounts that
# are to be fetched by the root's daemon. Often, a user desires quicker
# access (e.g., when testing some email path). In such cases, the destination
# user (marked as is USER here in the poll lines) should set up a ~/.fetchmailrc
# for himself. This scripts generates such lines from the central file.
#
# By Rick van Rein.

# From stdin, select poll lines for user $1
function selectuser () {
	grep ^poll | grep "is $1 here"
}


for i in `cut -d: -f1 </etc/passwd`
do	homedir=`grep ^$i: /etc/passwd | cut -d: -f6`
	fetchfile=`selectuser $i </etc/fetchmailrc`
	if [ -z "$fetchfile" ]
	then	rm -f $homedir/.fetchmailrc
	else	cp /dev/null $homedir/.fetchmailrc
		chmod go-rwx $homedir/.fetchmailrc
		grep ^defaults /etc/fetchmailrc >>$homedir/.fetchmailrc
		selectuser $i </etc/fetchmailrc >>$homedir/.fetchmailrc
	fi
done
chmail supports all standard mail-retrieval protocols in use on the Internet: POP3 (including some variants such as RPOP, APOP, KPOP), IMAP4rev1 (also IMAP4, IMAP2bis), POP2, IMAP4, ETRN, and ODMR. On the output side, fetchmail supports ESMTP/SMTP, LMTP, and invocation of a local delivery agent. Fetchmail also fully supports authentication via GSSAPI, Kerberos 4 and 5, RFC1938 one-time passwords, Compuserve's POP3 with RPA, Microsoft's NTLM, Demon Internet's SDPS, or CRAM-MD5 authentication a la RFC2195. Fetchmail supports end-to-end encryption with OpenSSL, do read README.SSL for details on fetchmail's configuration and README.SSL-SERVER for server-side requirements. NOTE! To be compatible with earlier releases, fetchmail 6.3's default behaviour is more relaxed than dictated by the standard - add options such as --sslcertck to tighten certificate checking. Portability ----------- The fetchmail code was developed under Linux, but has also been extensively tested under the BSD variants, AIX, HP-UX versions 9 and 10, SunOS, Solaris, NEXTSTEP, OSF 3.2, IRIX, and Rhapsody. It should be readily portable to other Unix variants and Unix-like operating systems (it uses GNU autoconf). It has been ported to Cygwin, LynxOS and BeOS and will build there without special action. It has also been ported to QNX; to build under QNX, see the header comments in the Makefile. It is reported to build and run under AmigaOS. Further reading --------------- The INSTALL file describes how to configure and install fetchmail. See the distribution files FEATURES for a full list of features, NEWS for detailed information on recent changes, NOTES for design notes, and TODO for a list of things that still need doing. If you want to hack on this code, a list of known bugs and to-do items can be found in the file todo.html. Status, source code ------------------- The fetchmail code appears to be stable and free of bugs affecting normal operation (that is, retrieving from POP3 or IMAP in single-drop mode and forwarding via SMTP to sendmail). You can get the code from the fetchmail home page: http://www.fetchmail.info/ http://fetchmail.sourceforge.net/ Enjoy! -- esr, ma