MPOP(1) | General Commands Manual | MPOP(1) |
mpop - A POP3 client
In mail retrieval mode of operation, mpop retrieves mails from one
or more POP3 mailboxes, optionally does some filtering, and delivers them
through a mail delivery agent (MDA), to a maildir folder, or to an mbox
file. Mails that were successfully delivered before will not be retrieved a
second time, even if errors occur or mpop is terminated in the middle of a
session.
In server information mode, mpop prints information about one or more POP3
servers.
If no account names are given on the command line, one named default
will be used.
The best way to start is probably to have a look at the EXAMPLES section.
The standard sendmail exit codes are used, as defined in sysexits.h.
Options override configuration file settings, for every used account.
A suggestion for a suitable configuration file can be generated
using the --configure option. The default configuration file is ~/.mpoprc or
$XDG_CONFIG_HOME/mpop/config. Settings in this file can be changed by
command line options.
A configuration file is a simple text file. Empty lines and comment lines
(first non-blank character is '#') are ignored. Every other line must
contain a command and may contain an argument to that command. The argument
may be enclosed in double quotes (").
If a file name starts with the tilde (~), this tilde will be replaced by
$HOME.
If a command accepts the argument on, it also accepts an empty argument
and treats that as if it was on.
Commands are organized in accounts. Each account starts with the
account command and defines the settings for one POP3 account.
Commands are as follows:
If the delivery method needs to parse the mail headers for an envelope from address (the mda method if the command contains %F, and the mbox method), then it needs to create a temporary file to store the mail headers (but not the body) in. See $TMPDIR in the FILES / ENVIRONMENT section.
There are three filtering commands available. They will be
executed in the following order:
killsize
skipsize
filter
If a filtering command applies to a mail, the remaining filters will not be
executed.
Configuration file
# Example for a user configuration file ~/.mpoprc
#
# This file focusses on TLS, authentication, and the mail delivery method.
# Features not used here include mail filtering, timeouts, SOCKS proxies,
# TLS parameters, and more.
# Set default values for all following accounts.
defaults
# Always use TLS.
tls on
# Set a list of trusted CAs for TLS. The default is to use system
settings, but
# you can select your own file.
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Deliver mail to an MBOX mail file:
delivery mbox ~/Mail/inbox
# Deliver mail to a maildir folder:
#delivery maildir ~/Mail/incoming
# Deliver mail via procmail:
#delivery mda "/usr/bin/procmail -f '%F' -d $USER"
# Deliver mail via the local SMTP server:
#delivery mda "/usr/bin/msmtp --host=localhost --from='%F' -- $USER"
# Deliver mail to an Exchange pickup directory:
#delivery exchange c:\exchange\pickup
# Use an UIDLS file in ~/.local/share instead of ~/.mpop_uidls
uidls_file ~/.local/share/%U_at_%H
# A freemail service
account freemail
# Host name of the POP3 server
host pop.freemail.example
# As an alternative to tls_trust_file, you can use tls_fingerprint
# to pin a single certificate. You have to update the fingerprint when the
# server certificate changes, but an attacker cannot trick you into accepting
# a fraudulent certificate. Get the fingerprint with
# $ mpop --serverinfo --tls --tls-certcheck=off --host=pop.freemail.example
#tls_fingerprint
00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
# Authentication. The password is given using one of five methods,
see below.
user joe.smith
# Password method 1: Add the password to the system keyring, and
let mpop get
# it automatically. To set the keyring password using Gnome's libsecret:
# $ secret-tool store --label=mpop \
# host pop.freemail.example \
# service pop3 \
# user joe.smith
# Password method 2: Store the password in an encrypted file, and
tell mpop
# which command to use to decrypt it. This is usually used with GnuPG, as in
# this example. Usually gpg-agent will ask once for the decryption password.
passwordeval gpg2 --no-tty -q -d ~/.mpop-password.gpg
# Password method 3: Store the password directly in this file.
Usually it is not
# a good idea to store passwords in cleartext files. If you do it anyway, at
# least make sure that this file can only be read by yourself.
#password secret123
# Password method 4: Store the password in ~/.netrc. This method
is probably not
# relevant anymore.
# Password method 5: Do not specify a password. Mpop will then
prompt you for
# it. This means you need to be able to type into a terminal when mpop
runs.
# A second mail box at the same freemail service
account freemail2 : freemail
user joey
# The POP3 server of your ISP
account isp
host mail.isp.example
auth on
user 12345
# Your ISP runs SpamAssassin, so test each mail for the "X-Spam-Status:
Yes"
# header, and delete all mails with this header before downloading them.
filter if [ "`grep "^X-Spam-Status: Yes"`" ]; then exit 1;
else exit 0; fi
# Set a default account
account default : freemail
Filtering with SpamAssassin
The command filter "/path/to/spamc -c > /dev/null" will delete all mails that SpamAssassin thinks are spam. Since no message body is passed to SpamAssassin, you should disable all body-specific tests in the SpamAssassin configuration file; for example set use_bayes 0.
If your mail provider runs SpamAssassin for you, you just have to
check for the result. The following script can do that when used as an mpop
filter:
#!/bin/sh
if [ "`grep "^X-Spam-Status: Yes"`" ]; then
exit 1 # kill this message
else
exit 0 # proceed normally
fi
Since the filter command is passed to a shell, you can also use this directly:
filter if [ "`grep "^X-Spam-Status:
Yes"`" ]; then exit 1; else exit 0; fi
Using mpop with Tor
Use the following settings:
proxy_host 127.0.0.1
proxy_port 9050
tls on
Use an IP address as proxy host name, so that mpop does not leak a DNS query
when resolving it.
TLS is required to prevent exit hosts from reading your POP3 session.
mpop was written by Martin Lambers <marlam@marlam.de>
Other authors are listed in the AUTHORS file in the source distribution.
procmail(1), spamassassin(1), netrc(5) or ftp(1), mbox(5), fcntl(2)
2022-06 |