Relay email (nullmailer): Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 21: | Line 21: | ||
{{Cat|/etc/nullmailer/allmailfrom|me@example.com}} | {{Cat|/etc/nullmailer/allmailfrom|me@example.com}} | ||
Whenever mail nullmailer deals with addresses without hostname or domain defaulthost and defaultdomain files can be used to set defaults, but | Whenever mail nullmailer deals with addresses without hostname or domain then defaulthost and defaultdomain files can be used to set defaults, but this will do the same using one file. So mail From: me and To: me will become From: me@localhost.example and To: me@localhost.example. Note that this applies to headers which are kind of informational only shown on mail client and envelope sender and recipient must be set correctly in any case using configuration files explained above. | ||
Ideally you would own and control a domain you could use but if not, then set to something guaranteed non-existing domains like localhost.example. Do not just pick some random non-existing domain as somebody could register it in the future. | |||
{{Cat|/etc/nullmailer/me|example | {{Cat|/etc/nullmailer/me|localhost.example}} | ||
To configure relay server to which mails are sent to add one line per remote server. Typically this would be your ISPs mail server. Optionally supports different authentication schemes: | To configure relay server to which mails are sent to add one line per remote server. Typically this would be your ISPs mail server. Optionally supports different authentication schemes: |
Revision as of 14:32, 1 February 2025
Overview
Nullmailer is lightweight and simple MTA (mail transport agent) which allows to relay local mails to another server. This is useful if you are in example running private server at home and just want to relay notifications from cron etc. to your external mailbox via your ISPs mail server. Nullmailer allow also to rewrite envelope sender which is needed to pass spam checks many ISPs are nowadays doing.
Installation
Nullmailer can be found only from the testing
branch. How to Enable the Testing Repository
# apk add nullmailer@testing
Configuration
Nullmailer is configured using individual files under /etc/nullmailer/, one file per setting.
When mail is sent to any local user i.e. "root", "logcheck", "me@localhost" etc. then mail can be sent to some external address or addresses (comma separated list) instead:
Contents of /etc/nullmailer/adminaddr
When nullmailer relays mail to remote server then envelope sender can be overridden as often mail gets rejected if envelope sender has non-existent domain like root@localhost.lan (note that envelope sender is not the same as From: header which nevertheless stays root@localhost.lan but that is not typically rejected):
Contents of /etc/nullmailer/allmailfrom
Whenever mail nullmailer deals with addresses without hostname or domain then defaulthost and defaultdomain files can be used to set defaults, but this will do the same using one file. So mail From: me and To: me will become From: me@localhost.example and To: me@localhost.example. Note that this applies to headers which are kind of informational only shown on mail client and envelope sender and recipient must be set correctly in any case using configuration files explained above.
Ideally you would own and control a domain you could use but if not, then set to something guaranteed non-existing domains like localhost.example. Do not just pick some random non-existing domain as somebody could register it in the future.
Contents of /etc/nullmailer/me
To configure relay server to which mails are sent to add one line per remote server. Typically this would be your ISPs mail server. Optionally supports different authentication schemes:
Contents of /etc/nullmailer/remotes