On Wed Nov 11 1998 at 03:29, "Steve Sykes" wrote:
> My mail fetcher runs from root via the crontab. To get mail to my user
> account I have placed a .forward file in /root which just has the name of
> the user account. In the user account I have the .procmailrc file. Is this
> correct?
With unix systems, there's almost always many more than one way to do a lot
of things, but doing this is really ugly :-)
[the very fact that you posted this message implies that you are suspicious
that there could - must - be a better way to do it :=]
I'm not sure what you are using as your "mail fetcher", but I assume that
it is fetchmail. If not, then I would **highly** recommend using it.
If you are running it (fetchmail) as root, then you can set it up to use a
/root/.fetchmailrc file to collect email as for any user. Eg, it would
have an entry that looks like something this:
poll mailserver.emirates.net.ae
protocol pop3
authenticate password
user ssykes there with password PASSWORD is steve here
mda "/usr/bin/procmail -Y"
See what's happening here? The mail will get delivered to the local
workstation to the user account "steve". No need for the mail to go
through the root mail account at all. (In fact, this situation should
really be avoided... root mail is (normally) for root).
And in this case, the mail is being given directly to procmail (the local
mail delivery agent) rather than via the default mail daemon listening on
the SMTP port 25 (usually sendmail).
This is an ideal situation where, for an intermittent dialup PPP
connection, you can start fetchmail automatically in daemon mode (see
below) when the link comes up (ie, when /etc/ppp/ip_up is run) and have it
terminated when the link goes back down (/etc/ppp/ip_down).
But an ordinary user can also run fetchmail (manually) as a daemon (eg,
"fetchmail -d 600" which will make it check for mail every 10 minutes).
You just need to have something similar (identical?) as above in your
~/.fetchmailrc file (which, btw, contains a password so it needs to be
chmod 600 to prevent anyone else from reading what's in it).
Take your pick how you do it, but there's certainly no need for a cron job
to be set up to do it... fetchmail has this functionality built in already.
Hope this helps. Good luck.
Cheers
Tony