postfix help needed
I am new to Linux so I hope to get some help setting up my mail server.
The host name of my linode is lixxx.members.linode.com and I am running Ubuntu 7.10. I installed postfix by "apt-get install postfix".
I am hosting multiple domains (e.g. foo.com and bar.com) I'd like to setup an email server so that I can send mails from
My main.cf is as follows:
Debian specific: Specifying a file name will cause the first
line of that file to be used as the name. The Debian default
is /etc/mailname.
myorigin = /etc/mailname
smtpdbanner = $myhostname ESMTP $mailname (Ubuntu)
biff = no
appending .domain is the MUA's job.
appenddotmydomain = no
Uncomment the next line to generate "delayed mail" warnings
delaywarningtime = 4h
TLS parameters
smtpdtlscert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpdtlskey_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpdusetls=yes
smtpdtlssessioncachedatabase = btree:${queuedirectory}/smtpdscache
smtptlssessioncachedatabase = btree:${queuedirectory}/smtpscache
See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
information on enabling SSL in the smtp client.
myhostname = lixxx.members.linode.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = lixxx.members.linode.com, localhost.members.linode.com, , localhost
relayhost =
mynetworks = 127.0.0.0/8
mailboxsizelimit = 0
recipient_delimiter = +
inet_interfaces = all
my own stuff
virtualmailboxdomains = foo.com, bar.com
virtualmailboxbase = /var/spool/mail
The content in /var/spool/mail:
root@lixxx:/var/spool/mail # ll
total 24
drwxr-sr-x 2 root mail 4096 Mar 27 01:26 foo.com
drwxr-sr-x 2 root mail 4096 Mar 27 01:26 bar.com
I also modified the DNS settings of my domains in my registrar:
A record foo.com (my linode's IP)
C record mail.foo.com (my linode's host name, i.e. lixxx.members.linode.com)
MX record lixxx.members.linode.com
After all this, when I send mails to
<
Reporting-MTA: dns; lixxx.members.linode.com
X-Postfix-Queue-ID: F0889C8C6
X-Postfix-Sender: rfc822;
Arrival-Date: Thu, 27 Mar 2008 04:47:54 -0400 (EDT)
What have I done wrong? Is it a file permission problem since the mail folders belong to root? Do I need a client besides postfix to read mail? Any help is much appreciated!
10 Replies
This way you can read your mail any way you normally would on that system.
@pclissold:
You don't seem to have virtualmailboxmaps implemented. This maps
user@domain.tld to /var/spool/domain/user_mailbox.
Thank you very much pclissold! It's right on! I created the virtualmailboxmaps text file but forget to linked to it in the main.cf. I should mentioned that postfix expects a .db file so I convert the text file to .db using the postmap command.
After that, I created a "vmail" user with uid and gid = 5000 and add the following lines to the main.cf file:
virtualuidmaps = static:5000
virtualgidmaps = static:5000
I also changed the mailbox folders to be owned by the "vmail" user. Now things seem to work. I grep the mail files and can see the incoming emails as text. What I really want to do is to access my mails from the web. Any recommendations on the software I should use? One thing I still can't wrap my head around is that, since my mails are owned by the vmail user which doesn't have login password/previlege, how are my mails password protected when I access them from the Web?
Thanks again!
James
@nabber00:
You might also want to look at virtualaliasmaps. This is similar to a normal /etc/aliases file and allows you to deliver the mail to a local user as usual, or forward:
postmaster@foo.com root
user@bar.com localuser
forward@bar.com user@someother.com This way you can read your mail any way you normally would on that system.
Thank you nabber00, I am going to look into this soon.
@jamesl:
What I really want to do is to access my mails from the web. Any recommendations on the software I should use?
I usefor my web mail. SquirrelMail needs an IMAP server - I use SquirrelMail, which also serves all my other IMAP and POP needs. Dovecot
> I use SquirrelMail for my web mail. SquirrelMail needs an IMAP server - I use Dovecot, which also serves all my other IMAP and POP needs.
> and Dovecot also integrates back into Postfix to provide SASL (what Postfix uses to auth users trying to send mail) quite nicely
I use this same setup, works nicely.
@pclissold:
@jamesl:What I really want to do is to access my mails from the web. Any recommendations on the software I should use?
I usefor my web mail. SquirrelMail needs an IMAP server - I use SquirrelMail, which also serves all my other IMAP and POP needs. Dovecot
I use RoundCube mail and wu-imapd (with a patch I wrote to report spam/ham to spamassassin). RC's interface is far more modern/slicker than squirrel mail, although it's still lacking in terms of plugins.
You can use both webmail clients on the same server if you want to try things out. Just install them to different directories.
I certainly wouldn't worry about trusting it with your email because the stable release is very solid, and compared to squirrelmail the UI is a dream.
BTW, if you're hosting lots of domains and users, then a system like postfixadmin to store your virtual maps and aliases in a database would make life much easier for you. There are some good guides at howtoforge for setting it up. If you only have a few domains and mailboxes it's probably not worth it though.