email creation username@domain.com

17 posts / 0 new
Last post
#1 Wed, 06/11/2008 - 03:59
rking

email creation username@domain.com

Hi hope someone is able to help me with this.

I am setting up a mail server using virtualmin and I am stuck creating e-mail users.

I am wanting to have the usernames like username@domain.com. however what happens is that it creates a file username@domain.com in /var/spool/mail, but if you send mail to this address it creates a new file username-domain.com and will not show up in the users inbox.

I can see that in postfix/Virtual Domains it has set up username@domain.com maps to username-domain.com

It has also created 2 users username@domain.com & username-domain.com with the same id.

Thanks in advance

Rob King

Wed, 06/11/2008 - 11:37
Joe
Joe's picture

See the FAQ:

http://www.virtualmin.com/documentation/id,frequently_asked_questions/#w...

And then switch to Maildir format mail spools.

user@domain.tld mail just doesn't work very well with mbox format spools...and there are no good reasons to use mbox format mailboxes anyway.

--

Check out the forum guidelines!

Wed, 06/11/2008 - 12:19 (Reply to #2)
sgrayban

What's wrong with mbox ? I think its just the opposite unless you can give me a good reason to stop pushing Maildir.

Wed, 06/11/2008 - 12:46 (Reply to #3)
Joe
Joe's picture

<div class='quote'>What's wrong with mbox ? I think its just the opposite unless you can give me a good reason to stop pushing Maildir.</div>

Nothing, in particular, is wrong with mbox, it's just a format that has lived beyond it's utility. For very small mailboxes (under 1000 messages, maybe) mbox is probably more efficient...and works fine. But, for very large mailboxes (think ten to hundreds of thousands of messages), Maildir is dramatically faster, particularly on delete and move operations. And, Maildir works fine on those small mailboxes, too. So, you can maybe get a slightly faster mailbox with mbox for very small values of &quot;mailbox&quot;, but if you want to be able to handle larger spools, mbox just doesn't handle it very well.

It is also, as mentioned, not possible (or at least not easy) to use user@domain.tld format usernames with Postfix and mbox format spools. Sendmail doesn't have this particular issue, but mbox still has the performance issues on large mailboxes.

Try a few operations on mailboxes with 25,000 messages in both mbox and Maildir formats, and then you can let us know which one is a better choice for modern mail servers. Right now my inbox has 9811 messages (and it's been known to get up to 36,000, though I'm trying to follow Inbox Zero principles these days, so I remove every email from Inbox as soon as I act on it...my queue of &quot;not acted on&quot; messages is a little long, I guess), my archived messages has over 20,000, and spam has 138,000 messages. And there are lots of other folders. mbox would make this volume of mail simply intolerably slow. I know, because up until a few years ago, I used mbox everywhere...the move to Maildir dramatically reduced the amount of time I spend waiting on moves, deletes, and opens. ;-)

Anyway, it's nothing to argue about. If you like mbox, and you like Sendmail, and you don't have mailboxes big enough to run into the limits of mbox, there's not reason to stop using them.

--

Check out the forum guidelines!

Wed, 06/11/2008 - 13:50 (Reply to #4)
sgrayban

So its the size of the box that makes the difference.

So how did you change from mbox to maildir? Isn't maildir a postfix format? I don't like postfix much and never really bothered with maildir because of that since I prefer sendmail.

Wed, 06/11/2008 - 14:00 (Reply to #5)
Joe
Joe's picture

<div class='quote'>So its the size of the box that makes the difference.</div>

Primarily, yes. Though, historically, mbox files live in /var/spool/mail, which complicates backups and other administrative tasks...if you like to think of virtual servers as independent entities, anyway. Maildir historically lives in the users home directory, and so a tarball of /home/domain will get all mail. Virtualmin, of course, abstracts that problem away, and can backup email wherever it is. And, it is <i>possible</i>, though not common, to put mbox format files into the users home...and folders in an IMAP-capable system do end up in the users home.

<div class='quote'>So how did you change from mbox to maildir?</div>

There are several tools out there. The best one is probably mb2md:

http://batleth.sapienti-sat.org/projects/mb2md/

Requires the Perl TimeDate module, but otherwise is standalone and easy to use.

If you aren't running into performance problems, sticking with mbox is fine.

<div class='quote'>Isn't maildir a postfix format?</div>

Not at all. It was created by djb for qmail, but has since been adopted by most mail servers, because it has turned out to be a better format for a large majority of mail servers. Since most sendmail users are using procmail for mail delivery, and procmail has excellent Maildir support, you have easy access to Maildir. Postfix does have direct delivery support for Maildir (and mbox and a couple of other formats), but Virtualmin Professional, by default, does not use Postfix for delivery--it uses procmail, just like most Sendmail users use. I don't think Sendmail handles delivery, at all, and always needs an MDA for any mailboxes format...so as far as Sendmail is concerned all mail spool formats are identical (but I might be misremembering...I just know I always used procmail for delivery when I did use sendmail in the past).

--

Check out the forum guidelines!

Wed, 06/11/2008 - 14:15 (Reply to #6)
velvetpixel

There is more info about mbox vs maildir <a href='http://' target='_blank'>here</a>

It comes down to mbox using a single file to store the mail records so for low quantities of stored mail that file is small but with lots of stored email for a single account that single file can become quite large and cumbersome for the mail application to work with.

Wed, 06/11/2008 - 14:16 (Reply to #7)
velvetpixel

EDIT!!!

<a href='http://www.courier-mta.org/mbox-vs-maildir/' target='_blank'>here</a>

Wed, 06/11/2008 - 14:20 (Reply to #8)
sgrayban

velvetpixel that link points to VM's home page. :)

Joe, so if I converted one user I have to do it for everyone ? And I assume that I need to shut down sendmail and dovecot for this too plus make the changes in WM/VM from mbox to maildir.

Wed, 06/11/2008 - 15:31 (Reply to #9)
Joe
Joe's picture

<div class='quote'>Joe, so if I converted one user I have to do it for everyone ?</div>

It's not mandatory, but you probably don't want to go down the road of having different types of spools for different users...that way lies madness.

<div class='quote'>And I assume that I need to shut down sendmail and dovecot for this too plus make the changes in WM/VM from mbox to maildir.</div>

Yes, you have to stop delivering new mail for a period of time. Dovecot can continue to run--since the mailbox isn't changing during the process, it won't matter. Once all boxes have been migrated, you change Dovecot to use the Maildirs, and restart it.

But, it does require a period of time where you aren't delivering new mail, and the safest way to do that is to just stop your MTA (sendmail). After making the migration, you'd update the procmailrc, and start sendmail back up.

Though, as I mentioned, if you aren't experiencing pain, mbox is fine. Dovecot probably has better caching and indexing than UW-IMAP, so it probably performs better with mbox than the benchmarks velvetpixel linked to.

That actually points out another issue with those benchmarks...they compare two completely different IMAP servers, as well as comparing the format of the mail spool...since we're all using Dovecot for Maildir or mbox, it'd be hard to make those benchmarks mean much to us, since maybe Courier is just more efficient in some circumstances than UW-IMAP. But, in my experience Dovecot is notably faster when backed by a Maildir spool than an mbox spool, particularly when dealing with very large mail spools...and I've converted a lot of mailboxes over the years.

--

Check out the forum guidelines!

Wed, 06/11/2008 - 15:39 (Reply to #10)
sgrayban

I think I'm going to have to do this at some point. I got a client that just loves leaving all his mail on the server and its GIGS in size now, 20 gigs to be exact. I don't know if using maildir is even going to help.

Thu, 06/12/2008 - 06:14 (Reply to #11)
rking

Thank you for the information, I have now set up Maildir and seems to be working fine.

Mon, 02/18/2013 - 13:50 (Reply to #12)
blaflamme

Hello,

is that info still relevant and do the system needs to create 2 users when using the @ user format with Maildir?

Mon, 02/18/2013 - 14:16
andreychek

It's still relevant... but if you don't look at the password file, you'll never know :-)

It's not about the Maildir format though, it's that Postfix doesn't support users with an @ sign in it's name.

There's some detail about that here in the section "What's the deal with @ in mailbox usernames":

http://www.virtualmin.com/documentation/email/faq

Mon, 02/18/2013 - 14:36 (Reply to #14)
blaflamme

I'm actually using the username.domain format but it's kind of confusing for users tho. I preferably would try to avoid multiple user for the same user. Do we have the same problem with the % format? And if I want to switch from my current format to a new one, what are the steps to convert the existing ones?

Best,

Mon, 02/18/2013 - 15:29
andreychek

The FAQ links to this brief post by the Postfix author that explains that some symbols (including @ and %) aren't allowed in usernames used by Postfix:

http://archives.neohapsis.com/archives/postfix/2000-02/0902.html

There unfortunately isn't a good way to convert from one format to the next... you'd either need to delete and re-create the user, or you could generate a Virtual Server backup, delete the Virtual Server, change the username format in Virtualmin, and then restore the backup.

-Eric

Mon, 02/18/2013 - 16:05 (Reply to #16)
blaflamme

Ok thanks. I thought there was a simpler way but at least we can do it :)

Topic locked