https://wiki.archlinux.org/api.php?action=feedcontributions&user=Mooddha&feedformat=atomArchWiki - User contributions [en]2024-03-28T17:55:51ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Postfix_Local_Mail&diff=172638Postfix Local Mail2011-12-07T20:18:31Z<p>Mooddha: /* Step 1: Edit /etc/postfix/main.cf */ Typo</p>
<hr />
<div>[[Category:Networking (English)]]<br />
{{merge|Postfix}}<br />
The goal of this article is to setup Postfix for local mailbox delivery only. See: [[Postfix]] for a virtual mail delivery configuration.<br />
<br />
==Postfix Installation==<br />
Install {{package Official|postfix}} package with [[pacman]]:<br />
# pacman -S postfix<br />
<br />
{{Note|Even though Postfix can be made to run in a chroot, this document does not currently cover such setups.}}<br />
<br />
==Postfix Configuration==<br />
===Step 1: Edit /etc/postfix/main.cf===<br />
The only things you need to change are as follows. Uncomment them and modify them to the specifics listed below. Everything else can be left as installed by pacman.<br />
<br />
inet_interfaces = loopback-only<br />
mynetworks_style = host<br />
append_dot_mydomain = no<br />
default_transport = error: Local delivery only!<br />
<br />
If you want to control where the mail gets delivered and which mailbox format is to be used, you can do this by setting <br />
home_mailbox = /some/path <br />
or <br />
mail_spool_directory some/path<br />
''mail_spool_directory'' is an absolute path where all mail goes, while ''home_mailbox'' specifies a mailbox relative to the user's home directory. If the path ends with a slash ('/'), messages are stored in Maildir format (directory tree, one message per file); if it doesn't, the mbox format is used (all mail in one file). <br />
<br />
Examples:<br />
mail_spool_directory = /var/mail (1)<br />
home_mailbox = Maildir/ (2)<br />
1) All mail will be stored in /var/mail, mbox format<br />
<br />
2) Mail will be saved in ~/Maildir, Maildir format<br />
<br />
===Step 2: Edit /etc/rc.conf===<br />
Add postfix to the daemons list. Make sure you put it after the network has started.<br />
<br />
DAEMONS=(syslog-ng network netfs crond '''postfix''')<br />
<br />
===Step 3: Edit /etc/postfix/aliases===<br />
Namely, put a username in for the the following, substituting the correct username you desire (actual system account required) for USER<br />
<br />
# Person who should get root's mail. Don't receive mail as root!<br />
root: USER<br />
<br />
Run the following command as root. This creates the map file that postfix understands.<br />
<br />
postalias /etc/postfix/aliases<br />
<br />
In addition, create the file .forward in /root.<br />
<br />
nano /root/.forward<br />
<br />
In it, specify the user to whom root mail should be forwarded, e.g. ''user@localhost''.<br />
<br />
===Step 4: Start the daemon===<br />
<br />
postfix check<br />
<br />
If '''postfix check''' returns no errors, then start the daemon.<br />
<br />
/etc/rc.d/postfix start<br />
<br />
Check /var/log/mail.log for any errors.<br />
<br />
===Step 5: Test===<br />
Try sending an email. Even from yourself to yourself should be a good test.<br />
<br />
mail -s test user<br />
this is a test email.<br />
.<br />
<br />
Now check your mail using whatever client you desire.<br />
<br />
===Step 6: Test some more!===<br />
Make sure root mail forwards to the desired user; use the same test as above, but substitute root for user.</div>Mooddha