mynetworks =
gateway IP addressmydestination. Figured out
how to send email to local hosts, and added instructions.postalias, not
postmap. My mistake. Also added a new element to
the Remaining Problems list.Since Mandrake has exerted such efforts in improving the installation and desktop experiences for GNU/Linux (henceforth "Linux") users, it's a good solution for working at home.
Mandrake seems to have settled on postfix as the mail server of choice. I don't particularly want to get involved in the religious war about whether postfix, exim, qmail, or the venerable sendmail, is the right MTA. However, it is clear to me that postfix as supplied by Mandrake does not meet the needs of home office users such as me.
What we typically have is a dial-up, DSL, or cable link. We typically do not have a hostname and domain name that means anything to the rest of the world. We typically have an ISP with an SMTP server that will relay messages for us. In other words, we're typically not like even a small corporation with its own recognized domain name, etc.
If the above meets the description of your setup, read on, especially if you use Mandrake linux. Since it's so close, these directions will probably work on RedHat, but since RedHat seems more aligned with sendmail, they're probably not as useful to RedHat users. These will probably be near useless for people using Debian, Slackware, etc.
The postfix FAQ provides a wealth of information about configuring postfix, but doesn't seem to have a configuration that exactly aligns with what I'm describing here. Or at least it doesn't have that information all in one place. At any rate, if you can find the information in the FAQ, more power to you.
The Mandrake install of postfix comes with a bunch of configuration files, neatly installed in /etc/postfix. Most of the action will come in the main.cf file. Here are some things you'll need to change:
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/virtual?
A list of full addresses for
short addresses that should be delivered locally:
Here's what I have in mine:
root root@localhost
postmaster postmaster@localhost
rpg rpg@localhost
The first two should go in everyone's virtual alias file. The last is the name of my user account. You should add one such line for each user account on your computer. There might be just yours, or their might be your spouse's, coworkers, etc.
postmap /etc/postfix/virtual to create
the map file, /etc/postfix/virtual.db.The material I've covered above is also discussed in the postfix faq, under the heading Delivering some users locally while sending mail as user@domain.
Honestly, I have never been able to fully understand why I need aliases and virtual aliases, too. I'm sure if I were a real sysadmin sort of person, I would understand this. If anyone can explain this in words of O(1 syllable) that do not include RTFM (there are far too many M's to Fing R in one lifetime, thank you very much!), by all means send me an email and I will insert it here!
One problem with not having a real DNS name is that mailers often check up on your validity as a sender. Also, I learned to my great sadness that without setting up a canonical address, your bounce messages go to /dev/null, meaning you can't even tell that email is not getting through. Setting up a canonical address for yourself means that when you send email, there's a valid path for bounce messages to come back, etc.
Here's what you need to do:
sender_canonical_maps =
hash:/etc/postfix/sender_canonical/etc/postfix/sender_canonical, put a line
like the following for each local user account:username ISP account name@ISPrpg rpgoldman@bletcherous.isp.comroot to be my
personal email address as well:root rpgoldman@bletcherous.isp.compostmap /etc/postfix/sender_canonical/etc/postfix/sender_canonical.db./etc/postfix/main.cf:relayhost = ISP SMTP server/etc/postfix/main.cf:myorigin = ISPmydestination/etc/postfix/main.cf seems to work:mydestination = $myhostname, localhost.$mydomain, localhostlocalhost in there naked (in
addition to localhost.$mydomain, you'll get odd
name-lookup errors in your logs, and your mail won't be
delivered locally. I've done it!/etc/postfix/main.cf, seems to be benign, but
only if you set myorigin as well!mydomain = mydomainmailbox_command line in
/etc/postfix/main.cf.
Let me know if this is not true, please!
I suppose that there are some cases where you would not want to do this, but I can't think of any. I'm pretty sure any normal install of a linux distro would give you procmail.
Update [2004/10/13:rpg] This no longer
seems to be the case with Mandrake 10. There is no such
line in main.cf any longer.
For me, as for most of you, whether or not procmail handles your local mail is probably of little interest. If you have a setup like the one described at the head of this message, you are getting your mail from some other server, through POP, IMAP, or some such. For example, I get all of my "interesting" mail through fetchmail, and it's my fetchmail configuration that ensures that my email goes through procmail.
The "non-interesting" local mail will probably only be email sent to you by various system facilities (e.g., cron, Mandrake's msec security scanner, etc.), and email from other local hosts, if there are any other ones on your local network.
/etc/hosts. I don't know why, but
this seems to be the case, as far as some fairly strenuous
googling will reveal. Given that, if you have a machine named
master, that you wish to send emails to from
slave, then you need to make an
/etc/postfix/transport file that has this:master relay:[absolute ip
address]/etc/hosts, which is annoying, but seems to be
absolutely necessary./etc/postfix/main.cf:transport_maps = hash:/etc/postfix/transportpostmap transport.
/etc/postfix/main.cf:alias_database = hash:/etc/postfix/aliases/etc/postfix/aliases. As far as I can
tell, all you have to do is add the following line so you get
root's emails:root: my user accountpostalias /etc/postfix/aliases/etc/rc.d/init.d/postfix restartchkconfig --list postfixSpecify dbm instead of hash if your system uses dbm files instead of db. To find out what map types Postfix supports, use the command postconf -m.Well, I don't know about you, but on my system,
postconf
-m returns a list as long as my arm of map types
postfix supports. I.e., knowing what types is supports is not
enough to know what type you should use. I use hash and it
seems to work (either postfix is using the table properly, or
it's smart enough to just ignore it!). If anyone can provide
a more principled answer to this issue, I'd be delighted to
hear it.myuserid, root, etc.
correctly get delivered locally. But, the addresses
still get rewritten to
myuserid@myisp.com,
root@myisp.com.
This is annoying and untidy, but not actually a bug, since the
emails don't go to my ISP's SMTP sever. Still, I'd like to
fix it. I'd appreciate any suggestions about how to do
this.In general, if you've spotted any howlers here, please drop me an email to let me know!