[KLUG Members] Sendmail as POP3?

Robert G. Brown members@kalamazoolinux.org
Mon, 06 Jan 2003 22:11:47 -0500


>Funny, before I got the POP3 figured out on the local mail server, I realized
>that I could use PINE and log in as that user (who has a user account on that
>box which, apparently, also gives him an e-mail box) and read the mail obtained
>by fetchmail.
>
>I was worried that the mail location would "now be in PINE" and POP3 would not
>show it once I got it working, but hey, once I enabled the ipop3 service it
>(almost) worked.  One last tweak was needed.
Pine does not move stuff out of the file where your mail is located, until you 
tell it to do so. it will stay in /var/spool/mail/[username], which is where 
the pop3 server expects it to be.

In this case, you are logging in to the mail server and reading the locally 
delivered mail from a remote termianl (telnet,ssh or similar) session.

Hoever, what you were asking before were transport-related questions, so we
were talking about how to move the mail around nicely. This is something of
a change of subject...instead of ruinning a mail client remote from the mail 
server, you're now coming to the mail server and running PINE locally....

>I kind of get it, but can you shed any light on the matter?  Why is Sendmail in
>your diagram above (I'm not sending anything here)?
Becasue "sendmail" DOES NOT merely "send mail", it also receives mail, and 
processes it for local delivery. Think of fetchmail as a kind of network 
adapter, connecting pop3 to sendmail (locally) to perform the delivery in a 
consistant way.

>>>Progress!!  Details below.
>>Outstanding! I'm pruning any stuff that's already happened, etc.
>>>Tried to install ipop, couldn't find it anywhere.  Turns out it was
>>>already installed.  Man, I hate the GnomeRPM.
>>I do all this stuff at the command line. I also check before I try
>>to install something, and I keep a directoy of the version online.
>>I've found it save time and trouble.
>Good ideas.
None of these ideas are hard to set up or use.

>And the generic command line command for installing a rpm is ...?
rpm -ivh [path to rpm file]

I also suggest you:
man rpm

>>>Wouldn't that be two hensway?
>>No. Some people just don't know nothin' about grammar! :)
>Grammar?  I thought it was avoirdupois.
Oh, please. Henway are aviary-duplicates! :)

>> >Actually, it was already installed, I had to enable it as a service (
>> >calls itself ipop3), reboot, and, 'hey!' it works.
>> Actually, you don't have to reboot at all. For this kind of thing,
>> merely restarting xinted is fine.
>Which is why the option to restart ipop3 wasn't available, I guess.
Probably. You would need to know that ipop3 is configured to work via xinetd.
man xinetd or man ipop3d

>> >Which leads to my next questions:  Fetchmail isn't listed as a service
>> >I can "enable on boot."  So, how can I get it to fire on boot?
>> You can:
>>  1. Add it as a service.
>>  2. edit in a call to get it started in /etc/rc.d/rc.local
>>  3. Remember to start it yourself on those ultra-rare occasions when
>>     you do reboot.
>How to add a service?

>And the command line call for fetchmail (to stick in rc.local) would be?
I beleive you had it right, actually. I was merelt telling you where it would 
go to be run at startup.

>>>Lastly, the default "interval" is zero (0).  Does that mean it never runs?
>> Beats me. I think there's a default.
>Yup, the default is 0.
A perhaps true, but unhelpful reply. What does the default mean? What behavior
does fetchmail exhibit with this setting?

>> I wrote a script that starts and stops fetchmail, just like the other
>> scripts in /etc/rc.d/init.d, and for the asking I'll send it to you,
>> or even post it on this list so everyone can see it. That might make it
>> easier to execute choice 1, above. A magum opus it ain't.
>Ah then, please enlighten us.
After my signature. I wouldn't want our erudite parley to be broken up 
by a script.

>>>If seconds, then setting it to 300 would poll the external POP3 servers
>>>every five minutes, for example.
>>That's right. I think you can also set this for each pop3 server you're
>>polling, so if you get lots of mail from one, you can poll it more frequently,
>>and less frequently from others, where the traffic may be lighter. Fetchmail
>>also supports other mail polling/retrieval protocols, like IMAP.
>Well, that answers another question.  I kept configuring and then coming back
>to the config program for further changes: changing the default interval 
>wouldn't "take."  The default interval has to be assigned to a particular
>mailbox that is being polled.
OK. I never actually used that configuration program, the fetchmail 
configuration file uses a very easy-to-learn, almost English-language 
method... here's an example....

 poll thathost.net with proto pop3;
  user melvin there has password grub3by is
  bob here

You can have as many of those "sentences" as you have pop3 (or other) servers
to poll.

I hope all this helps...
							Regards,
							---> RGB <---

PS: The fetchmail script....

#!/bin/sh
#
# fetchmail     This shell script takes care of starting and stopping
#               fetchmail. Hacked from the sendmail script by RGB [2000-1-2]

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/bin/fetchmail ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.

        echo -n "Starting fetchmail: "
        fetchmail -a -d 1800 --syslog -f /etc/sysconfig/.fetchmailrc
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/fetchmail
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down fetchmail: "
        fetchmail -quit
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/fetchmail
        ;;
  restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  status)
        status fetchmail
        RETVAL=$?
        ;;
  *)
        echo "Usage: fetchmail {start|stop|restart|status}"
        exit 1
esac

exit $RETVAL