Submitted by Markoamb on Mon, 09/18/2017 - 05:55 Pro Licensee
Hi I am trying to enable Mail for one of the domain in Virtualmin but I got error: Mail for domain failed! : SQL insert failed : Duplicate entry '' for key 'PRIMARY' at /usr/share/webmin/web-lib-funcs.pl line 1433
Please advice. Kind regards Marko
Status:
Active
Comments
Submitted by andreychek on Mon, 09/18/2017 - 12:11 Comment #1
Howdy -- hmm, are you by chance using MySQL for storing usernames/passwords?
Or are you using the standard Linux /etc/passwd files for that?
Submitted by JamieCameron on Mon, 09/18/2017 - 22:07 Comment #2
Also, do you have Postfix setup to store mail aliases in MySQL?
Submitted by Markoamb on Tue, 09/19/2017 - 09:26 Pro Licensee Comment #3
Hi, yes, I am using MySQL for storing data as in postfix main.cf: virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf relay_domains = proxy:mysql:/etc/postfix/mysql_relay_domains.cf
since I was and still can adding domains and users etc. with postfix.admin (http://postfixadmin.sourceforge.net/)
Submitted by JamieCameron on Wed, 09/20/2017 - 19:22 Comment #4
Can you post the contents of those
.cf
files that you use to configured Postfix to talk to MySQL?Virtualmin tries to parse them to work your table structure, but I suspect it is going wrong.
Submitted by Markoamb on Thu, 12/21/2017 - 11:49 Pro Licensee Comment #5
Hi JamieCameron, .cf files are:
"mysql_virtual_mailbox_domains.cf" :
hosts = 127.0.0.1 user = someusername password = somepassword dbname = postfixadmin query = SELECT domain FROM domain WHERE domain='%s' and backupmx = 0 and active = 1
next:
"mysql_virtual_mailbox_maps.cf":
hosts = 127.0.0.1 user = someusername password = somepassword dbname = postfixadmindb query = SELECT maildir FROM mailbox WHERE username='%s' AND active = 1
next:
"mysql_virtual_alias_maps.cf":
hosts = 127.0.0.1 user = someusername password = somepassword dbname = postfixadmindb query = SELECT goto FROM alias WHERE address='%s' AND active = 1 table = alias select_field = domain where_field = active
next:
"mysql_relay_domains.cf":
hosts = 127.0.0.1 user = someusername password = somepassword dbname = postfixadmindb query = SELECT domain FROM domain WHERE domain='%s' and backupmx = 1
Submitted by JamieCameron on Fri, 12/22/2017 - 01:05 Comment #6
I think the problem is that
active
field - do you have multiple entries in thealias
table for the same address but with differentactive
values?