It seems that dbmail -smtp is failing to set the owner_idnr correctly.
(logs below)
The first query:
[SELECT user_idnr FROM users WHERE userid='[EMAIL PROTECTED]']
should get the correct userid, since I do when logged into mysql as
dbmail user.
mysql> SELECT user_idnr FROM users WHERE userid='[EMAIL PROTECTED]';
+-----------+
| user_idnr |
+-----------+
| 1 |
+-----------+
1 row in set (0.00 sec)
Yet the owner_idnr is set to zero in the next query.
[SELECT mailbox_idnr FROM mailboxes WHERE LOWER(name) =
LOWER('INBOX') AND owner_idnr='0']
The queries in the "mysql.log" verify the queries above are running as
shown in the mail.log.
It fails on a foriegn key constraing because there is no owner_idnr that
is zero.
Removing the foreign keys won't help since dbmail would still assign all
the messages to mailbox owner "zero".
Any suggestions?
Below is the pertinet mail.log info.
Feb 23 02:46:20 debian dbmail/smtp[9699]: dbmysql.c,db_query: executing
query [SELECT user_idnr FROM users WHERE userid='[EMAIL PROTECTED]']
Feb 23 02:46:20 debian dbmail/smtp[9699]: pipe.c, resolve_address: added
user [EMAIL PROTECTED] id [1] to delivery list
Feb 23 02:46:20 debian dbmail/smtp[9699]: misc.c,create_unique_id:
created: d17f8f3488fea9f4c832fa2393756465
Feb 23 02:46:20 debian dbmail/smtp[9699]: dbmysql.c,db_query: executing
query [SELECT mailbox_idnr FROM mailboxes WHERE LOWER(name) =
LOWER('INBOX') AND owner_idnr='0']
Feb 23 02:46:20 debian dbmail/smtp[9699]: dbmysql.c,db_query: executing
query [INSERT INTO mailboxes (name, owner_idnr,seen_flag, answered_flag,
deleted_flag, flagged_flag, recent_flag, draft_flag, permission) VALUES
('INBOX', '0', 1, 1, 1, 1, 1, 1, 2)]
Feb 23 02:46:20 debian dbmail/smtp[9699]: dbmysql.c,db_query: query
[INSERT INTO mailboxes (name, owner_idnr,seen_flag, answered_flag,
deleted_flag, flagged_flag, recent_flag, draft_flag, permission) VALUES
('INBOX', '0', 1, 1, 1, 1, 1, 1, 2)] failed
Feb 23 02:46:20 debian dbmail/smtp[9699]: dbmysql.c,db_query:
mysql_real_query failed: Cannot add or update a child row: a foreign key
constraint fails