IMAP Virtual Domain: Failure to get mailbox for default domain. Mailbox does not exist



MailNews Core
Networking: IMAP
14 years ago
10 years ago


(Reporter: Erik Norgaard, Assigned: Bienvenu)



Firefox Tracking Flags

(Not tracked)



(2 attachments)



14 years ago
User-Agent:       Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.1) Gecko/20040721
Build Identifier: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.1) Gecko/20040721

I have set up Cyrus-IMAP server with virtual domains, and migrated my mailbox'es
to the default domain. Things works if I disable virtual domains. However,
enabling virtual domains I get the following error: Mailbox does not exist.


1. Added a virtual domain mailbox, There is no problem reading
mail for that account (login:

2. Tried other client, Squirrelmail: Access to both defaultdomain account and

3. Disabled virtual domains: access to my default domain, no access to (expected).

4. Specified login to defaultdomain account as 'me', me@defaultdomain and
me%defaultdomain. None works when virtual domains are enabled.

5. Changed default domain: Cyrus fails. 

6. Uncommented 'defaultdomain' config line in imapd.conf: cyrus fails.

I cannot completely exclude a bug in cyrus-imapd since imapd does not accept
other default domains than the hostname's domain. However the fact that things
work with Squirrelmail makes me suspect an error in Mozilla MailNews.

Server info: cyrus-imap 2.2.8, cyrus-sasl 2.1.19, cyrus-sasl-saslauthd 2.1.19,
OS: FreeBSD 4.10.

Reproducible: Always
Steps to Reproduce:
1. Setup cyrus-imap v. 2.2.8: my imapd.conf is as follows:
-------- imapd.conf ---------
configdirectory: /var/imap
partition-default: /var/imap/spool
altnamespace: yes 
virtdomains: yes
allowplaintext: yes
admins: cyrus root
defaultacl: anyone lrs
sieveusehomedir: false
sievedir: /var/imap/sieve
sasl_pwcheck_method: saslauthd
sasl_mech_list: plain cram-md5 digest-md5
fire up imapd.
2. Create a mailbox for the default domain eg. using cyradm, (add some mail, but
not sure if need to test).
3. Create account in Mozilla MailNews - normal procedure.
4. Open the inbox folder.
Actual Results:  
Failure: Mailbox does not exist

From the log: I can see that authentication succeeds.

Expected Results:  
MailNews should create a list of available folders and fetch messages for the inbox.

Comment 1

14 years ago

I have found a workarround: As noted in 5) cyrus fails, I changed defaultdomain.
Removing my domain from /etc/hosts allows to **** an alternate default domain,
and hence setup the original default domain as a virtual domain:

In /etc/hosts:
::1                     localhost               localhost

In imapd.conf:
defaultdomain: localhost

The "Mailbox does not exits" error persists, but now with @localhost mailboxes
which at least provides a working solution.

Comment 2

14 years ago
a client side imap protocol log of a failed session would be helpful:


Comment 3

14 years ago
Created attachment 156238 [details]
Log output

This log contains client and server side log (server side is a bit sparce). 

First part is the client side log, shows unsuccesfull opening of mailbox for
default domain (, then succesfull opening of mailbox for virtual
domain (

Second part is the server side log of the above connections.

Comment 4

14 years ago
in the virtual domain case, you'll see there's no personal namespace : NAMESPACE
NIL, and selecting the INBOX fails. I don't see the client doing anything wrong
- it seems like there is no INBOX or even personal namespace for the account
when you turn on virtual domains...

Comment 5

14 years ago
except perhaps we shouldn't try to select the INBOX where there's no personal
namespace, I guess. Do you expect that there should be an INBOX?

Comment 6

14 years ago
Created attachment 156267 [details]
mbox2imap batch migration tool

I created all mailfolders using this script for batch migration:

./ norgaard

This creates one mail account in the default domain, '', and another
in the virtual domain ''. Both contain the same mail, the same
folders etc.

I can log in using Squirrelmail, and check mail, delete mail etc. for both
accounts. In squirrelmail if I log in as 'norgaard', '' and
'' all sends me to the same namespace/mailaccount belonging
to the default domain's namespace. If I log in as ''
or '' I get the other mail account. This is all as I
would expect.

Doing the same using the mozilla mail, I only get access to the virtualdomain
account. The interesting thing is that if I disable virtual domains, then I
have normal access to the account in the default domain namespace (and
obviously not access to the virtual domain).

To me, this confirms that the INBOX does indeed exist. If I try to 'subscribe',
I see no folders or subfolders, even though they exist.

Comment 7

14 years ago
If you'll look at the protocol log, you'll see that the server is telling us
there's no INBOX:

148844032[8d9ea00]: 7 select "INBOX"
148844032[8d9ea00]: ReadNextLine [stream=8bd8d08 nb=29 needmore=0]
148844032[8d9ea00]: 7 NO
Mailbox does not exist

It seems like the default domain logon would be the simplest - we just pass in
the username. I don't see how Mozilla could be doing anything wrong in that
scenario. Are you changing the username in the account settings UI or by using
about:config/editing prefs.js by hand? Unfortunately, for privacy reasons, our
protocol log doesn't show the user name that gets sent...

Comment 8

14 years ago
> I don't see how Mozilla could be doing anything wrong in that scenario. 
> Are you changing the username in the account settings UI or by using 
> about:config/editing prefs.js by hand? 

No, I have created the accounts through the normal interface. The error "Mailbox
does not exist" seems to be a consequence of the lacking namespace. I did a
sniffing on the packets and tried to replay the connection by hand using telnet,
and I can only confirm the mozilla log.

I didn't exclude the posibility that it's an cyrus-imap bug, and I have posted
on the cyrus mailing list.

I am experiencing wierd things with cyrus (in particular squirrelmail no longer
works?!) so I am less certain that this is a mozilla bug. I'll return when I
know more from the cyrus people.

Thanks for your time, and sorry if I have wasted it. Erik

Comment 9

14 years ago
Hi there,

I haven't got any news from the Cyrus people, but this morning it occured to me:
If I can't select the mailbox, how on earth did I get the mail in there in the
first place? My migration script transfers mail using the imap protocol, and for
performance it connects to localhost.

So I tried telnetting to localhost, and the default domain works. While
connecting on the normal interface returns namespace NIL. This explains why I
could have Squirrellmail working since it was running on the same host (and it
stopped working because I for some reason decided to change the server address). 

So, I conclude that this is not a bug in Mozilla mail. I am really sorry for
taking your time, this bug is beyond normal obscurity I think. For your interest
I have included the two telnet sessions below...

Best regards, and thanks. Erik

Mystery deepens... Here is what I got:

Telnetsession on loopback interface:
[norgaard@top norgaard]$ telnet 143
Connected to
Escape character is '^]'.
* OK Cyrus IMAP4 v2.2.8 server ready
1 login "" ******
1 OK User logged in
2 namespace
* NAMESPACE (("" ".")) (("Other Users." ".")) (("Shared Folders." "."))
2 OK Completed

Telnet session on real interface:
[norgaard@top norgaard]$ telnet 143
Connected to
Escape character is '^]'.
* OK Cyrus IMAP4 v2.2.8 server ready
1 login "" ******
1 OK User logged in
2 namespace
* NAMESPACE NIL (("Other Users." ".")) (("Shared Folders." "."))
2 OK Completed
Last Resolved: 14 years ago
Resolution: --- → FIXED

Comment 10

14 years ago
No bug / patch referenced.  From the comments, this doesn't seem like a bug with
Mozilla code anyway.

Resolution: FIXED → ---


14 years ago
Last Resolved: 14 years ago14 years ago
Resolution: --- → WORKSFORME

Comment 11

14 years ago
Eric, no problem; glad you've figured it out to some extent. If you figure out
what's going on with Cyrus, maybe you could append that info here, and if
someone else has the same problem, I can point them to the info.

Comment 12

14 years ago
I have finally traced the problem in case anyone should ask. It would be quite
wierd if cyrus took special care for the loopback interface, and it doesn't.
Cyrus does a reverse lookup on the ip that recieves the incoming connection. The
returned hostname must be one under the default domain.

So the solution to that kind of problem is to get reverse dns right, or add
entries to /etc/hosts. From the cyrus mailinglist I was finally told,

> Use:
> virtdomains: userid
> and it won't do this.  The reverse lookup is to support configs where 
> each virtdomain is serviced by a particular IP.

But then all would have to login with a fully qualified login. This behaviour is
perfectly fine (I think) if there was no default domain specified, but otherwise
I would expect cyrus to assume the default domain.

So, not only am I now embarassed to admit that the problem was local, worse, I
have also now found that the 'reverse lookup' was actually documented :-(
However, I still think a specified default domain should take precedence.

Thanks again, at least I learned something about the IMAP protocal :-)
Regards, Erik
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.