Next Previous Contents

3. Usage

3.1 General Usage

Just pipe mails to filter after fetching them.
Usage: mailf [-d Domain] [-n Postmaster] ([-t ToDomain] [-s Host] [-l logfile])
mailf [-d Domain] [-n Postmaster] ([-t ToDomain] [-m MDA] [-l logfile])
mailf [-d Domain] [-n Postmaster] ([-r address] ...)

mailf [-d ...] [-n ...] (...) ([--keepresend] [--novbs] [--no550])

mailf [-d ...] [-n ...] (...) ([--vscan "/path../scanner opt"])

mailf [-d ...] [-n ...] (...) ([--delmass] | [--mass2pm])

mailf [-v] [-h | --help]
-d Domain part (default: yourdom.zzz)
-n Postmaster Name/Alias (default: postmaster)
-t Rewrite to this Domain
-r EMail address for all mails (ignores all addresses in header)
-s SMTP Host (only if other than localhost)
-m MDA for send mail
-l Logfile

--keepresend On local error, not delete mail (please see other options for details)
--no550 Mails "550 user unknown" won't be send to sender of a mail

--novbs Overwrite VB-Worm-Virus common file extensions with .txt
--vscan Scan attachments for virus with external scanner

--delmass Delete mails contain X-Mailer: ...Mass Sender... (Spam)
--mass2pm Send mass mail with notify to postmaster and delete

-v Display Version Info
-h Display this short help

3.2 Examples for use with sendmail and fetchmail

For default mailf uses SMTP on localhost to send mails and postmaster as postmasteralias:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d yourdomain.xxx"
---snip---


Example for mail.yourdomain.xxx as SMTP-Host to send mails:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d yourdomain.xxx" -s mail.yourdomain.xxx
---snip---


Example for webmaster@yourdomain.xxx as postmasteralias and "/usr/bin/sendmail -t" as MDA:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d yourdomain.xxx -n webmaster -m '/usr/bin/sendmail -t'"
---snip---
!!! Important: If there are spaces in the -m statement than it have to be quoted !!!


Example for different internet and local domain and webmaster as postmasteralias:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d internet-domain.xxx -t local-domain.yyy -n webmaster"
---snip---


Example for yourdomain.xxx as offical domain, localdomain.yyy as localdomain, mailadmin as postmasteralias, mail.localdomain.yyy as SMTP-Host and /var/log/mailf.log as logfile:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d yourdomain.xxx -t localdomain.yyy -n mailadmin \
-s mail.localdomain.yyy -l /var/log/mailf.log"
---snip---
!!! Important: The user mailf is started with must have write permission to the file /var/log/mailf.log !!!


Example for different internet and local domain and webmaster as postmasteralias:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d internet-domain.xxx -t local-domain.yyy -n webmaster"
---snip---


Example for "/usr/local/uvscan/uvscan --secure" as Virusscanner, not delete infected files from tmp-folder only from mail and Mass Mailer spam to postmaster:
.fetchmailrc:
---snip---
poll mail.provider.xxx protocol POP3 no dns user multimailbox password xxxxx \
mda "/usr/local/bin/mailf -d yourdomain.xxx -n postmaster --mass2pm --vscan '/usr/local/uvscan/uvscan --secure' --nodelvir"
---snip---
!!! Important: If there are spaces in the --vscan statement than it have to be quoted and path must be absolute path(begins with /) !!!


For details about fetchmail syntax, please refer fetchmail manual pages or the fetchmail homepage.

3.3 Handling QMail prefixes in Delivered-To: lines

The Delivered-To: lines of QMail contain a prefix to the mailaddress. If mails are fetched from a provider using QMail, the filter will try to resend the mail with the mailadress including the prefix. The result of such resend-tries are "550 User unknown" errors. With the -qp QMail-Prefix option (by Guillermo Borgobello) these prefix will be striped of the mailaddress.

Example:
.fetchmailrc:
---snip---
poll mail.provider.xxx ... mda "/usr/local/bin/mailf ...(options as above)... -qp qmail_"
---snip---

3.4 Known problems

Version V0.7.0 - V0.7.3:

Occasional SIGPIPE/not flushed if fetchmail runs in daemon mode

If fetchmail runs in daemon mode sometimes filter sends SIGPIPE or reports non z zero status to fetchmail. If fetchmail is started from shell without -d option I haven't noticed such behaviour till now.

Things learned so far: Status:
This problem should be solved in version V0.7.4 (07461), but I'm not quite sure. Because it happens only sometimes I have to watch it a little more. For now it looks ok and the problem anyway only causes a mail to be fetched twice or not before fetchmail were killed and started again. I haven't lost any mail because of this problem.

Version V0.7.4:

In builds before V0.7.4 (07464) some options were deaktivated for debuging. Since V0.7.4 (07465) no problems occured so far.

Version V0.7.5:

None found so far.

Version V0.7.10 + V0.7.11:

If using --novbs option mails contain attachments as text in body not as file.
Status:
Fixed since V0.7-final


Next Previous Contents