Re: [ILUG] Mail laziness

From: kevin lyda (kevin at domain suberic.net)
Date: Thu 20 Jul 2000 - 12:42:08 IST


On Thu, Jul 20, 2000 at 10:39:52AM +0100, Noel Carroll wrote:
> I want to set up my linux box so that it will connect into my ISP and
> collect my mail automatically and send anything I've got queued. I guess
> I'd need sendmail for that right? Time to refer to Running Linux yet
> again! Has anybody got this going and what did you do to set it up.

i was sure there would be dozens of answers to this by now. ok...

your question has two parts. part one is collecting mail:

now you could use sendmail's etrn feature. i don't know much about it,
but i think nick hilliard is a *huge* fan so i'll let him ramble on
about it.

alternatively you could use uucp - kenn humborg actually does like that
one, but sadly isp's don't. it actually is a shame because uucp is
rather nice. a uucp based napster would be pretty cool.

so what you'll really be using is fetchmail. you can either run it in
daemon mode (or guardian angel mode depending on how easily offended
you are) or you can run it from your crontab.

for sending it you do use sendmail. check out the install sendmail
script.

now, for how i do it. since my box can be connected at home, work
or directly through a modem, i do the following:

    sendmail: it's configured to always queue mail, and i run it from
    inetd, not as a daemon. see comments in inetd.conf, make sure
    to turn off the sendmail startup.

    fetchmail: fetchmail is set up to grab mail from two accounts but
    it doesn't run as a daemon either. see the fetchmail man page
    and fetchmailconf.

    cron: cron runs a script once every 20 minutes. the script sees
    if i have an internet connection and if so it runs fetchmail
    and has sendmail process it's queue.

the script looks like:

# snip
#!/bin/sh
#####
HOMEFIREWALL=xxxxx
HOMESUBNET=xxx.xxx.xxx
WORKSUBNET=xxx.xxx.xxx
# Am I connected at home?
/sbin/ifconfig eth0 > /dev/null 2>&1
if [ $? -eq 0 ]; then
    /sbin/ifconfig eth0|grep -q $HOMESUBNET
    if [ $? -eq 0 ]; then
        rsh $HOMEFIREWALL /sbin/ifconfig | grep -q ppp0
        if [ $? -eq 0 ]; then
            fetchmail -s -t60
            /usr/lib/sendmail -q
            exit 0;
        fi
    fi
fi

#####
# Am I connected via modem?
/sbin/ifconfig | grep -q ppp0
if [ $? -eq 0 ]; then
    fetchmail -s -t60
    /usr/lib/sendmail -q
    exit 0;
fi

#####
# Am I connected at work?
/sbin/ifconfig eth0 > /dev/null 2>&1
if [ $? -eq 0 ]; then
    /sbin/ifconfig eth0|grep -q $WORKSUBNET
    if [ $? -eq 0 ]; then
        fetchmail -s -t60
        /usr/lib/sendmail -q
    fi
fi
# snip

kevin

-- 
kevin at domain suberic.net       "there's nothing wrong with windows 2000 that
fork()'ed on 37058400    linux can't fix."  -- va linux t-shirt
meatspace place: work    


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:06:55 GMT