This is an old revision of the document!
Z) Forwarding Email Setup
Assuming you already have a full email server (either hosted by you or you are using some third party service), you will need your internal server (the home server) to be able to send emails. This is true even if you host your email server, because as i say here, you cannot self-host a real email server on your home server.
The following must be performed on your internal server.
The Gentoo default mail-mta/nullmailer package is more than enough. It should be already installed, otherwise emerge it:
emerge mail-mta/nullmailer
For future memory, Nullmailer home page is here.
Configuration
Nullmailer is pretty much undocumented. 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:
- remotes
mail.mydomain.com smtp port=587 user=home@mydomain.com pass=**** starttls
Then define an admin email address to send important emails (errors, etc):
- adminaddr
myself@mydomain.com
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:
- defaultdomain
mydomain.com
- defaulthost
mydomain.com
- me
mydomain.com
Yeah, doesn't make much sense, but this is the only setup i found working for me.
Usage
Try it from the command line:
(echo "Subject: test email"; echo "Hi! my nullmailer works...") | sendmail -F "Me Myself" -f myself@mydomain.com destination@otherdomain.de