How to setup Fetchmail Sample file to download the mail [ Part-3/6 ]

Sample file /root/.fetchmailrc
#set syslog
pass "XXXXXX"
is test here

The permission for .fetchmailrc should be 610
#chmod 610 /root/.fetchmail

Procmail for mail forwarders

Sample / example for procmail files :
Sort out all mail coming from the scuba-dive mailing list into the mailfolder scubafile (uses the locallockfile

* ^TOscuba

Forward all mail from peter about compilers to william (and keep a copy of it here in petcompil).

* ^From.*peter
* ^Subject:.*compilers
:0 c


A simple autoreply recipe. It makes sure that neither mail from any daemon (like bouncing mail or mail from mailing-lists), nor autoreplies coming from yourself will be autoreplied to. If this precaution would not be taken, disaster could result (‘ringing’ mail). In order for this recipe to autoreply to all the incoming mail, you should of course insert it before all other recipes in your rcfile. However, it is advisable to put it after any recipes that process the mails from subscribed mailinglists; it generally is not a good idea to generate autoreplies to mailinglists (yes, the !^FROM_DAEMON regexp should already catch those, but if the mailinglist doesn’t follow accepted conventions, this might not be enough).
:0 h c
* !^X-Loop: your@own.mail.address
| (formail -r -I"Precedence: junk" \
-A"X-Loop: your@own.mail.address" ; \
echo "Mail received.") | $SENDMAIL -t

A more complicated autoreply recipe that implements the functional equivalent of the well known vacation(1) program. This recipe is based on the same principles as the last one (prevent ‘ringing’ mail). In addition to that however, it maintains a vacation database by extracting the name of the sender and inserting it in the vacation.cache file if the name was new (the vacation.cache file is maintained by formail which will make sure that it always contains the most recent names, the size of the file is limited to a maximum of approximately 8192 bytes).
If the name was new, an autoreply will be sent.

As you can see, the following recipe has comments between the conditions. This is allowed. Do not put comments on the same line as a condition though.

SHELL=/bin/sh # for other shells, this might need adjustment

:0 Whc: vacation.lock
# Perform a quick check to see if the mail was addressed to us
* $^To:.*\<$\LOGNAME\>
# Don’t reply to daemons and mailinglists
# Mail loops are evil
* !^X-Loop: your@own.mail.address
| formail -rD 8192 vacation.cache
:0 ehc # if the name was not in the cache
| (formail -rI"Precedence: junk" \
-A"X-Loop: your@own.mail.address" ; \
echo "I received your mail,"; \
echo "but I won’t be back until Monday."; \
echo "-- "; cat $HOME/.signature \
) | $SENDMAIL -oi -t


PART-1 Configure complete sendmail server in rhel.

PART-2 Creating the Certificate for secured communication(dovecot).

PART-3 Fetchmail Sample file to download the mail.

PART-4 Installation of CLAMAV antivirus.

PART-5 Mailscanner quick install notes.

PART-6 Installation instruction MailWatch & SpamAssassin.

Post a Comment

Mới hơn Cũ hơn