Alaveteli sends and receives email. You'll need to set up your Mail
Transfer Agent (MTA) to handle this properly. We've got examples
here for both postfix and exim4, two of the most popular MTAs.
Note: If you are editing an existing exim config rather than creating a new one, check the
untrusted_set_sender
option in
/etc/exim4/conf.d/main/02_exim4-config_options
. By default, untrusted users in exim are only allowed to set an empty envelope sender address, to declare that a message should never generate any bounces.
untrusted_set_sender
can be set to a list of address patterns, meaning that untrusted users are allowed to set envelope sender addresses that match any of the patterns in the list. If a pattern list is specified, you will need also to add
ALAVETELI_USER
to the
MAIN_TRUSTED_USERS
list in order to allow them to set the return path on outgoing mail. This option is also in
/etc/exim4/conf.d/main/02_exim4-config_options
in a split config. Look for the line that begins with
MAIN_TRUSTED_USERS
- something like:
MAIN_TRUSTED_USERS = uucp
and add the alaveteli user:
MAIN_TRUSTED_USERS = uucp : alaveteli
If
untrusted_set_sender
is set to
*
, that means that untrusted users can set envelope sender addresses without restriction, so there's no need to add
ALAVETELI_USER
to the
MAIN_TRUSTED_USERS
list.
The name and location of the log files created by Exim must match what the
`load-mail-server-logs` script expects, which is why you must provide the
`log_file_path` setting.
The `check-recent-requests-sent` scripts expects the logs to contain the
`from=<...>` envelope information, so we make the logs more verbose with
`MAIN_LOG_SELECTOR`.
Setting `extract_addresses_remove_arguments` to `false` gets exim to treat the `-t` command line option that the `mail` gem uses when specifying delivery addresses on the command line as specifying that the addresses should be added, not removed. See [this `mail` issue](https://github.com/mikel/mail/issues/70) for more details.
#### Pipe incoming mail for requests from Exim to Alaveteli
In this section, we'll add config to pipe incoming mail for special
Alaveteli addresses into Alaveteli, and also send them to a local backup
mailbox.
Create the `backupfoi` UNIX user
adduser --quiet --disabled-password \
--gecos "Alaveteli Mail Backup" backupfoi
Specify an exim `router` for special Alaveteli addresses, which will route messages into Alaveteli using a local pipe transport:
cat > /etc/exim4/conf.d/router/04_alaveteli <<'EOF'
alaveteli_request:
debug_print = "R: alaveteli for $local_part@$domain"
driver = redirect
data = ${lookup{$local_part}wildlsearch{ALAVETELI_HOME/config/aliases}}
pipe_transport = alaveteli_mailin_transport
EOF
Create `/etc/exim4/conf.d/transport/04_alaveteli`, which sets the properties of the pipe `transport` that will deliver mail to Alaveteli:
cat > /etc/exim4/conf.d/transport/04_alaveteli <<'EOF'
alaveteli_mailin_transport:
driver = pipe
command = $address_pipe ${lc:$local_part}
current_directory = ALAVETELI_HOME
home_directory = ALAVETELI_HOME
user = ALAVETELI_USER
group = ALAVETELI_USER
EOF