LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Setting up a mail server with Dovecot and/or Postfix with virtual domains (https://www.linuxquestions.org/questions/linux-server-73/setting-up-a-mail-server-with-dovecot-and-or-postfix-with-virtual-domains-685483/)

Josh1billion 11-23-2008 12:32 AM

Setting up a mail server with Dovecot and/or Postfix with virtual domains
 
I installed Postfix, and later realized Dovecot was already installed. I believe they are both running.. simultaneously.. yet I haven't had any problems. Odd.

You may have already noticed that this is the first time I've set up a mail server. It's actually the first time I've had to set up a dedicated server on my own from scratch (it's a web server + mail server + nameserver + FTP server). Anyway, so far so good. I have it set up in such a way that my Linux users are e-mail accounts, i.e. to create a new e-mail address, all I have to do is set up a new Linux user.

However, that only pertains to my main domain name. I also have a few other domain names hosted as virtual domains on this server. How can I create e-mail accounts that are "at" (@) the other domains? I have the nameserver section already complete (MX records are good), I just need to know how to create the e-mail addresses for these other domains.

billymayday 11-23-2008 01:03 AM

Quote:

Originally Posted by Josh1billion (Post 3351563)
I installed Postfix, and later realized Dovecot was already installed. I believe they are both running.. simultaneously.. yet I haven't had any problems. Odd.

What's odd about that? One's an MTA, the other an imap/pop server. They are meant to run together.

Start by reading http://www.postfix.org/VIRTUAL_README.html and decide how fancy you want to get (key thinking points will be number of domains, number of users in each, etc.)

Josh1billion 11-23-2008 03:35 AM

Quote:

Originally Posted by billymayday (Post 3351576)
What's odd about that? One's an MTA, the other an imap/pop server. They are meant to run together.

Start by reading http://www.postfix.org/VIRTUAL_README.html and decide how fancy you want to get (key thinking points will be number of domains, number of users in each, etc.)

Oh, I figured they were essentially the same thing.

Link isn't working at the moment; I'll have to check it later. But essentially, I have about three domains that need e-mail addresses, and I'll only need about.. five or less addresses on each.

Josh1billion 11-25-2008 03:04 PM

I took a look at that link and set up Postfix so that it recognizes my virtual domains (i.e. it will no longer reject e-mails sent to those domains).

But how do I now create e-mail addresses under those virtual domains?

billymayday 11-25-2008 03:22 PM

See the example given in the link titled "Postfix virtual MAILBOX example: separate domains, non-UNIX accounts"

Code:

10 /etc/postfix/vmailbox:
11    info@example.com    example.com/info
12    sales@example.com  example.com/sales/
13    # Comment out the entry below to implement a catch-all.
14    # @example.com      example.com/catchall
15    ...virtual mailboxes for more domains...

where info@example.com is a virtual email address and its mailbox is in $virtual_mailbox_base/example.com/info.

Note you can have virtual aliases and whatnot as well (they show an alias example on lines 17/18

Important note - you would create this file (vmailbox) with a text editor, but you must execute "postmap /etc/postfix/vmailbox" for postfix to be able to use it as specified. Ditto for the virtual alias file (anything you see referred to with has: in main.cfexcept the main alias file which requires you run newaliases).

Josh1billion 11-25-2008 04:13 PM

I have now added the following code to the files indicated (without the numbers to the left and filenames, of course). I am trying to create the e-mail addresses EMAILREMOVED and EMAILREMOVED for the joshforde.com virtual domain, hosted on my server whose main domain name is seedsoftime.net

Code:

    1 /etc/postfix/main.cf:
    2    virtual_mailbox_domains = joshforde.com
    3    virtual_mailbox_base = /var/mail/vhosts
    4    virtual_mailbox_maps = hash:/etc/postfix/vmailbox
    5    virtual_minimum_uid = 100
    6    virtual_uid_maps = static:5000
    7    virtual_gid_maps = static:5000
    8    virtual_alias_maps = hash:/etc/postfix/virtual
    9
    10 /etc/postfix/vmailbox:
    11    EMAILREMOVED joshforde.com/admin/
    12    EMAILREMOVED joshforde.com/josh/

I then typed the commands "postfix reload", "postmap /etc/postfix/vmailbox", and "postmap /etc/postfix/virtual" as indicated in the guide.

Of course.. I am not yet able to log in with my e-mail client, which isn't surprising as I haven't yet seen any place in configuration files to enter passwords for the two e-mail addresses I tried to create. What else am I missing / Where do I enter passwords?

billymayday 11-25-2008 04:17 PM

First, I'd take those emails out of your post in cash they get harvested.

Nothing I don't think (you probably needed to do the postmapping prior to the reload). Send a message to one of those accounts and see if anything gets created in the relevant mailbox (are you wanting Maildir format?)

Josh1billion 11-25-2008 04:39 PM

Thanks for the heads-up, I forgot about e-mail harvesting for a minute.

Quote:

Originally Posted by billymayday (Post 3354218)
Send a message to one of those accounts and see if anything gets created in the relevant mailbox (are you wanting Maildir format?)

What is Maildir format?

EDIT:

I tried sending a test e-mail to the address, and it didn't work. Here's the message shown in Mozilla Thunderbird:

http://i35.tinypic.com/20fpbtz.png

billymayday 11-25-2008 04:48 PM

Maildir is basically where each message is a file in itself, whereas mbox is one big file with all the messages one after the other. I think most people prefer maildir, since it's less open to corruption, faster to perform certain actions on (such as delting a message) etc.

Doesn't really matter. The "/" at the end of the location is the giveaway.

One thing though, maildir uses 3 directories for each account (cur, new and tmp). The delivery probably creates these for a new account on first delivery, but it's possible you will get an error and need to create these manually.

Did you get any mail delivered? If not, "tail /var/log/maillog"

Josh1billion 11-26-2008 08:32 PM

...

This is all going over my head. >_< Server configuration is definitely not my thing.

billymayday 11-26-2008 08:50 PM

Doesn't really matter - leave it as is.


How's it going otherwise?

Josh1billion 11-27-2008 02:36 AM

Nothing really changed since my last couple of replies.. I can't figure out how to create an e-mail address for the virtual domain. :/ Most of the information in the above link is beyond my comprehension. I'm surprised I was able to set up a everything I did so far (nameserver, FTP, virtual domain hosting, etc.) on this machine.

billymayday 11-27-2008 02:57 AM

Can you be specific? The example given seems pretty clear to me.

Rgds

BM


All times are GMT -5. The time now is 09:16 PM.