Scenario:
- I own the domain example.com.
- I am signed up with an email provider, and configured my account as a catchall for *@example.com. I use the email dude@example.com.
- I have a VPS running Ubuntu 18.04, which will host example.com.
- On the VPS, I have a user called dude.
I want to:
- configure Postfix as a send-only SMTP server to be able to send email as whatever@example.com. Inspired by this guide.
- Particularly, I want some system, log, or application messages to be sent to me at dude@example.com and receive them at my external email provider (which I realize could be a little weird, because my VPS user is also dude).
To my novice mind, this seems like it would be a pretty common setup.
Long story short, this is not working quite as expected when I send some test emails to root or postmaster (echo test | mail -s testsubject postmaster
). I think I have some ideas about how to fix it, but it has made me think that I might be digging myself into a hole and committing to a bad setup.
So I have some more general questions:
- Should I completely abandon the user = dude and email = dude@example.com setup? Is that setting me up for crazy problems in the future?
- Is it a better idea for my server to send as a subdomain? E.g. whatever@mail.example.com.
- If the above answers are "No", then: can this kind of set up be accomplished with only aliases in /etc/aliases and other config options, or do I need to use virtual alias maps? This is potentially the most detail-oriented of my questions, so I am really only asking in a general sense.
I appreciate any advice folks might be able to give. I've read through all the comments on the guide, looked at lots of the suggested questions here, and have dozens of tabs open across two computers trying to sort this out!
Edit: This is a summary of relevant settings that I've wound up with, which I think are a balance between "works for me" and "I could modify my approach if I needed to, without tearing my hair out". Three files below, with the first being just an excerpt (hence the ellipsis). My understanding is that /etc/aliases
never gets used (because example.com
, $myhostname
, and $mydomain
are not in mydestination
), but I included it anyway because it was part of my testing, and it seems like good practice to have it.
/etc/postfix/main.cf
...
myorigin = example.com
myhostname = example.com
mydomain = $myhostname
mydestination = localhost.$mydomain, localhost
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
...
/etc/aliases
postmaster root
root dude
/etc/postfix/virtual
postmaster root
root dude