Difference between revisions of "OpenSMTPD"

From ArchWiki
Jump to: navigation, search
m (edit /etc/smtpd/smtpd.conf)
(create domain and user maps)
Line 34: Line 34:
 
}}
 
}}
  
=== create domain and user maps ===
+
=== create domain and user tables ===
  
'''/etc/smtpd/vdoms''' - put one domain per line
+
* For the domain table file; simply put one domain per line
{{bc|personaldomain.org
+
businessname.com}}
+
  
'''/etc/smtpd/vusers''' - map inbound email addresses to local mbox user account names or SMTP email addresses.
+
{{hc|/etc/smtpd/vdoms|
Begin each line with one SMTP address. In the second column put one or more user account names or SMTP addresses, separated by a comma. Mix and match as desired.
+
personaldomain.org
{{bc|
+
businessname.com
 +
}}
 +
 
 +
* For the user table file; list one inbound SMTP email addresses per line and then map it to an mbox user account name, SMTP email address, or any combination of the two on the right, separated by commas.
 +
 
 +
{{hc|/etc/smtpd/vusers|
 
roger@personaldomain.org          roger
 
roger@personaldomain.org          roger
 
newsletters@personaldomain.org    roger,roger.rulz@gmail.com
 
newsletters@personaldomain.org    roger,roger.rulz@gmail.com
Line 49: Line 52:
 
shirley@businessname.com          shirley
 
shirley@businessname.com          shirley
 
info@businessname.com            roger,shirley
 
info@businessname.com            roger,shirley
contact@businessname.com          info@businessname.com}}
+
contact@businessname.com          info@businessname.com
 +
}}
  
 
==Starting the server==
 
==Starting the server==

Revision as of 00:55, 17 March 2014

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary end

Required packages

Installation

# pacman -S opensmptd

simple OpenSMTPD/mbox configuration

create user accounts

  • Create a user account on the mail server for each discrete mailbox.
# useradd -m -s /bin/bash roger
# useradd -m -s /bin/bash shirley
  • OpenSMTPD will deliver messages to the user account's mbox file at /var/spool/mail/<username>
  • Multiple SMTP email addresses can be delivered into one mailbox if desired.

smtpd.conf

  • A working configuration can be had in as little as five lines!
/etc/smtpd/smtpd.conf
listen on eth0 hostname myemaildomain.com
table vdoms             "/etc/smtpd/vdoms"
table vusers            "/etc/smtpd/vusers"
accept from any for domain <vdoms> virtual <vusers> deliver to mbox
accept from source { localhost 10.1.1.0/24 } for any relay

create domain and user tables

  • For the domain table file; simply put one domain per line
/etc/smtpd/vdoms
personaldomain.org
businessname.com
  • For the user table file; list one inbound SMTP email addresses per line and then map it to an mbox user account name, SMTP email address, or any combination of the two on the right, separated by commas.
/etc/smtpd/vusers
roger@personaldomain.org          roger
newsletters@personaldomain.org    roger,roger.rulz@gmail.com

roger@businessname.com            roger
shirley@businessname.com          shirley
info@businessname.com             roger,shirley
contact@businessname.com          info@businessname.com

Starting the server

Use the standard systemd syntax to control the smtpd.service daemon.

# systemctl start smtpd.service

To have it start on boot

# systemctl enable smtpd.service

Watch the spice flow!

# journalctl -f _SYSTEMD_UNIT=smtpd.service

See also