User Tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
email:forward [2025/03/19 19:57] – [Forwarding Email Setup] willyemail:forward [2026/04/14 07:37] (current) willy
Line 10: Line 10:
 emerge mail-mta/nullmailer emerge mail-mta/nullmailer
 </code> </code>
 +
 +For future memory, Nullmailer home page is [[https://untroubled.org/nullmailer/|here]].
  
 ===== Configuration ===== ===== Configuration =====
  
-I assume you already have a mail domain somewhere linked to your **@mydomain.com**, and you have your own address as **myself@mydomain.com** and you created a specific mailbox called **home@mydomain.com** to manage any email sent from services.+Nullmailer is pretty much undocumented. [[https://www.troubleshooters.com/linux/nullmailer/|This]] blog post is mostly the only piece of documentation around, even Arch and Debian wiki's points to this old blog post. 
 + 
 +First of all, you **must** already have a mail domain somewhere linked to your **@mydomain.com**, and you have your own address as **myself@mydomain.com** and you created a specific mailbox called **home@mydomain.com** to manage any email sent from services. 
 + 
 +The key point is to configure the home@mydomain.com as the source address to send all email from, which doesn't mean that the emails will actually come from that address, but that address will be used to deliver the emails. 
 + 
 +All the following files need to be under **/etc/nullmailer**. 
 + 
 +So, configure relay: 
 +<file - remotes> 
 +mail.mydomain.com smtp port=587 user=home@mydomain.com pass=**** starttls 
 +</file>
  
-All the following files need to be under **/etc/nullmailer**:+Then define an //admin// email address to send important emails (errors, etc):
 <file - adminaddr> <file - adminaddr>
 myself@mydomain.com myself@mydomain.com
 </file> </file>
  
 +Now the tricky part, there are three files you must configure properly:
 +- defaultdomain: the domain you are sending email from
 +- defaulthost: you cannot leave this empty, and in my experiments the only working value is identical to defaultdomain content
 +- me:  again, not clear what this stand for, but it works if you replicate again the content of default domain.
 +
 +so:
 <file - defaultdomain> <file - defaultdomain>
 mydomain.com mydomain.com
Line 25: Line 44:
  
 <file - defaulthost> <file - defaulthost>
-mail+mydomain.com
 </file> </file>
  
 <file - me> <file - me>
-mail+mydomain.com
 </file> </file>
  
-<file - remotes> +Yeah, doesn't make much sense, but this is the only setup i found working for me.
-mail.mydomain.com smtp port=587 user=home@mydomain.com pass=**** starttls +
-</file>+
  
 ===== Usage ===== ===== Usage =====
  
-Try it from the command line:+In order for your root (or any user) emails to be sent to a specific address (example, myself@mydomain.com) you need to create a **~/.forward** file with the target email address in it: 
 +<file - .forward> 
 +myself@mydomain.com 
 +</file> 
 + 
 +Now, try it from the command line:
 <code bash> <code bash>
 (echo "Subject: test email"; echo "Hi! my nullmailer works...") | sendmail -F "Me Myself" -f myself@mydomain.com destination@otherdomain.de (echo "Subject: test email"; echo "Hi! my nullmailer works...") | sendmail -F "Me Myself" -f myself@mydomain.com destination@otherdomain.de
 </code> </code>
 +
 +Now test that the forward setting works as well:
 +<code bash>
 +echo "This is a test email from root" | mail -s "Test Subject" root
 +</code>
 +
 +you should receive both emails at myself@mydomain.com, even if the second one is directed a //root// on the local machine nullmailer will forward that.