Installing Fetchmail
Originally taken from http://www.thedjbway.org/services/fetchmail.html
Modified for Freebsd courtesy of William Olson
fetchmail is a mail retrieval utility written by Eric S. Raymond. It is extremely flexible and configurable for a variety of retrieval and forwarding applications.
Although fetchmail has its own daemon mode, using it with a daemontools setup will provide some advantages. These include:
* consistent control interface through daemontools' svc utility
* reliable, platform-independent daemon start-up and run
* logging with multilog
Lets first install fetchmail:
# cd /usr/ports/mail/fetchmail
# make install clean
Here we also create a directory where fetchmail will reside:
# cd /var/qmail/supervise
# mkdir -m 755 fetchmail
# cd fetchmail
# fetch http://freebsdrocks.net/files/run.fetchmail
# mv run.fetchmail run
# chmod 755 run
# mkdir -m 755 log
# cd log
# fetch http://freebsdrocks.net/files/log-run
# mv log-run run
# chmod 755 run
Now to set the correct ownership on the supervise file so you can write the pid file:
# chown fetchmail:fetchmail /var/qmail/supervise/fetchmail/
If you open up the run file, you will see the INTERVAL which is the amount of seconds to wait before checking messages. Right now it is set to check messages every 5 minutes.
Now lets configure the /usr/local/etc/fetchmailrc
replace pop.server below with the actual name of the pop server
replace the user with the actual username of the host you are checking
replace the pass with the actual password of the host you are checking
The SMTP host is the IP of your qmail server. This is needed so fetchmail doesn't have to auth with qmail.
poll pop.server
with protocol pop3
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
smtphost 192.168.9.10
Multiple lines/polls can exist. If you're checking multiple email accounts on one server, you can just use something like so:
poll pop.server
with protocol pop3
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
smtphost 192.168.9.10
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
smtphost 192.168.9.10
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
smtphost 192.168.9.10
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
smtphost 192.168.9.10
Or if you're checking multiple servers:
poll pop.server
with protocol pop3
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
poll pop.server
with protocol pop3
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
poll pop.server
with protocol pop3
username user password pass is
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
here
Lots of different combinations are avilable.
# chown fetchmail:nofiles fetchmailrc
# chmod 600 fetchmailrc
And then create the service:
# ln -s /var/qmail/supervise/fetchmail /service/
After a few seconds run
# svstat /service/fetchmail/ /service/fetchmail/log/
And you should see something like:
/service/fetchmail/: up (pid 50481) 4 seconds
/service/fetchmail/log/: up (pid 50482) 4 seconds
If you want to force fetchmail to check messages, The svc -t /service/fetchmail command will force fetchmail to terminate and restart giving you the same effect.
| < Prev | Next > |
|---|


