If anyone is interested, here are my mail scripts for getting and sorting mail.
/etc/fetchmail/fetchmailrc: (I have postmaster as an alias of philip)
set logfile "/var/log/fetchmail.log" set syslog set postmaster "postmaster" set bouncemail set properties "" set invisible set idfile "/etc/fetchmail/fetchids" set daemon 500
poll mail.vsnl.net with proto AUTO uidl: user tellis there, with password xxxxxxx, is philip here; options warnings 3600 dropstatus limit 1000000 fetchall
~philip/.procmailrc:
LOGFILE=.procmail.log #LOGABSTRACT=none VERBOSE=off
:0 *From: .*spammers and people I don't like /dev/null
:0 *From: .*(regex of my sister's friends) !mysister
:0 *To: .*regex that covers all my sister's names/nicknames !mysister
:0 *(To|Cc): .*regex that covers my all my sister's email addresses !mysister
:0 *To: .*regex that matches mails that both my sister and I must receive { :0 c !mysister
:0: mail/incoming/folder where I want this mail to go }
:1 Subject: .*Ilug-Bom Web Site - Updated mail/trash
:1: *To: .*linuxers mail/incoming/lug-incoming
:1: *From: .*Webmonkey mail/webmonkey
(and on and on)
/etc/ppp/ip-up.local:
[ $# -lt 1 ] && DEV="ppp0" || DEV=$1 # find out which interface pppd is connected to
MYIP=$(/sbin/ifconfig $DEV | grep "inet addr" | cut -f2 -d: | cut -f1 -d' ') # find out the IP of that interface
echo -e "$MYIP\ttellis.vsnl.net" >> /etc/hosts # add this IP to /etc/hosts so that sendmail doesn't cry when a # remote host tried to do a reverse lookup
[ "$(date | egrep -i '(sun)|((23)|(0[0-7])):..:..')" != "" ] \ && RCFILE="/etc/fetchmail/fetchmailrc" \ || RCFILE="/etc/fetchmail/fetchmailrc.day"
# Since I get free time between 11 and 8 and Sundays, I should # only download large mails at these times. Otherwise, use a # fetchmailrc that limits max mail size to 10K. This only makes # sense if the server supports IMAP otherwise, it is worse.
echo "fetchmail: using $RCFILE" >> /var/log/fetchmail.log # log what we're doing
fetchmail -f $RCFILE # and start fetchmail with the correct rc file. Fetchmail # should run as a daemon
/usr/sbin/sendmail -q # flush the mail queue. This does not run as a daemon
# I should also change the queue processing interval here and reset it # in ip-down.local
exit 0
/etc/ppp/ip-down.local:
HOSTS=$(head -n 2 /etc/hosts) echo -e "$HOSTS" > /etc/hosts # get rid of the extra host line added # in ip-up.local # this is risky, but in my case safe
exit 0
/etc/sysconfig/network-scripts/ifdown-ppp:
# These lines are inserted after signalling ifup-ppp not to persist if # it hasn't already started
# This will check if there are messages in the mailq # It will try to send them and wait until all are sent.
if [ $( mailq | wc -l ) -gt 1 ]; then echo "Waiting for mail queue to flush..." >&2 /usr/sbin/sendmail -q fi;
# First check if fetchmail is running. If it is, wait for it to stop # This will go crazy if fetchmail is running in daemon mode because # then it will not stop.
# If you have fetchmail running in daemon mode, you may want to comment # out the lines below and put fetchmail -q in /etc/ppp/ip-down.local
# You should check /var/run/fetchmail.pid to see the pollinterval. # Fetchmail should not be run as a daemon because we don't know what # state it currently is in
# if [ -f /var/run/fetchmail.pid ]; then # echo "Waiting for fetchmail to stop..." >&2 # else
# If fetchmail wasn't running, then run it one last time to get any mail # that may have come in after the last check
# echo "Checking mail before disconnecting..." >&2 # fetchmail -f /etc/fetchmail/fetchmailrc # echo "Done..." >&2 # fi;
# while [ -f /var/run/fetchmail.pid ]; do # this could potentially # /bin/true # wait forever and isn't # done # recommended
Furthermore, the following is added to the panel of users:
~user/.gnome/panel.d/default/Applet_9_Extern:
[mail] animation_file=/usr/share/pixmaps/mailcheck/email.png update_frequency=15000 exec_command= mail_prog_command=xterm -e /usr/bin/pine
This causes a mailchecker to run in the Gnome panel. When new mail comes in, the mail icon starts spinning. Clicking the icon brings up pine, but you can make it bring up netscape messenger or kmail too.
Hope this helps others,
Philip
Sometime yesterday, Philip S Tellis wrote:
If anyone is interested, here are my mail scripts for getting and sorting mail.
Hmmm. Interesting stuff!
/etc/fetchmail/fetchmailrc: (I have postmaster as an alias of philip)
What does postmaster mean?
:0 *From: .*(regex of my sister's friends) !mysister
! is for forward?
:1 Subject: .*Ilug-Bom Web Site - Updated mail/trash
:)) I have a similar rule. It goes to /dev/null though.
/etc/ppp/ip-up.local:
echo -e "$MYIP\ttellis.vsnl.net" >> /etc/hosts # add this IP to /etc/hosts so that sendmail doesn't cry when a # remote host tried to do a reverse lookup
Is this absolutely necessary? What's the use?
HOSTS=$(head -n 2 /etc/hosts) echo -e "$HOSTS" > /etc/hosts # get rid of the extra host line added # in ip-up.local # this is risky, but in my case safe
HOSTS=$(sed -e'$d' /etc/hosts)
Manish
Sometime Today, Manish Jethani assembled some asciibets to say:
/etc/fetchmail/fetchmailrc: (I have postmaster as an alias of philip)
What does postmaster mean?
Person who gets status messages (oversized mail rejected, blocked sender rejected, etc)
!mysister
! is for forward?
Yes. Uses sendmail -oi
echo -e "$MYIP\ttellis.vsnl.net" >> /etc/hosts # add this IP to /etc/hosts so that sendmail doesn't cry when a # remote host tried to do a reverse lookup
Is this absolutely necessary? What's the use?
This is the result of a very old thread on the list - when we were just over 150 users.
If I don't put it in, I get this in maillog:
Aug 10 12:54:33 tae sendmail[2553]: gethostbyaddr(203.197.53.40) failed: 1 Aug 10 12:54:43 tae sendmail[2572]: gethostbyaddr(203.197.53.40) failed: 1 Aug 10 12:55:26 tae sendmail[2636]: gethostbyaddr(203.197.53.40) failed: 1 Aug 10 12:56:22 tae sendmail[2719]: gethostbyaddr(203.197.53.40) failed: 1
One for each mail that leaves my system. This is so because the IP address does not match any host name. In Windows, when setting properties for your ppp interface, you specify server assigned IP address, and hostname as username.domainname. That's exactly what I'm doing here.
HOSTS=$(head -n 2 /etc/hosts) echo -e "$HOSTS" > /etc/hosts # get rid of the extra host line added
HOSTS=$(sed -e'$d' /etc/hosts)
Thanks. This was done long before I started on sed and awk. Didn't feel like using perl for the job.
Philip
On Sat, 11 Aug 2001, Manish Jethani spewed into the ether: <snip>
What does postmaster mean?
Normally, for each service you run, you have a dedicated controller of that service. For mail, the person in charge of the service is called postmaster. There is an RFC of which aliases to maintain for which service. For mail: postmaster For www: webmaster For DNS: hostmaster For mailing lists: list-owner <snip>
Is this absolutely necessary? What's the use?
Some mail servers are configured to reject mail from hosts without a valid reverse DNS lookup. This normally goes to the name server in charge of your ip block, but it doesn't hurt to add this line. Also, it helps your mail server in logging information.
Devdas Bhagat