Local mail system configuration
Without mail forwarding, root mails are delivered to
(or mails in general to users
rootnpAi2idMF@fiTsiErfixZ.muni85ioXFMhF.cz
login
arrives at
login@fi.muni.cz
). To redirect, you need to create an alias and properly configure a mail system that supports aliases (eg Postfix, Exim).
Mail system configuration
You must edit the file when configuring the Postfix mail system
# vi /etc/postfix/main.cf
and add a row
relayhost = [relay.fi.muni.cz]
and then run the command
# postfix reload
Root mail forwarding
Aliases are stored in a file
/etc/aliases
(resp.
/etc/mail/aliases
). The location of the file depends on the mail system you are using. You must be logged in as to create / edit aliases
root
.
# vi /etc/aliases
For redirecting mail to users
root
add a row
root: login@fi.muni.cz
You must run the command after each change in the file
# newaliases
The command updates the alias database. For more information on aliases, see
man 5 aliases
.
Hostname setting
Make sure you have the correct hostname set, including the domain:
$ hostname
vasstroj.fi.muni.cz
On systems
systemd
you can set the hostname with the command
hostnamectl
:
# hostnamectl set-hostname vasstroj.fi.muni.cz
Redirection of mail generated by the command
sudo
For forwarding shape emails
*** SECURITY information for XY.fi.muni.cz ***
to an address other than the default, add with the command
visudo
to a new file
/etc/sudoers.d/mailto
line
Defaults mailto = adresa
But verify that
/etc/sudoers
contains line
#includedir /etc/sudoers.d
. Alternatively, you can edit directly
/etc/sudoers
.
Redirecting mails from cron
To redirect e-mails from cron, a line must be added to the file from which the tasks are run before the task definitions
MAILTO=login@fi.muni.cz
Problem solving
If you encounter problems during configuration, you may find the mail system logs, usually located at
/var/log/mail*
,
/var/log/postfix
or
/var/log/exim*/
. Use the command to find out the contents of the local mail queue
mailq
. If you come across something you can't handle, we'll advise you at
unixKiNyzc-o1@fih4xD=uzSG.muniVMRtJjeCv.cz
.