ok it seems it is auto creating a new user mbox ?
thus not returning the actual email address from the sql query.
below is my pgsql setup for reference
cat dovecot-pgsql.conf
driver = pgsql connect = host=localhost port=5433 dbname=scom_billing user=xxxx password=xxxxx default_pass_scheme = PLAIN
please note the password query below includes an alias condition
all of the sql queries need to be updated to support %u and the return
this will probably take some playing around.
also if using smtp auth via postfix the db querie files also need
to be updated or sending emails will probably throw errors
before it even gets to dovecot, dovecot only a mbox agent
postfix is responsible from actualy receiving the email and
passing it along to dovecot.
password_query = SELECT username as user, password FROM email_users WHERE username = '%u' and password <> 'alias' and status = True and destination = '%u'
user if the actual, password is password
WHERE username = should be the auth username
it is possible there is another % option that splits
auth username vs email address ?
user_query = SELECT home, uid, gid FROM email_users WHERE username = '%u' and password <> 'alias' and status = True and destination = '%u'
iterate_query = SELECT "username" as user, domain FROM email_users WHERE status = True and alias_flag = False
you will have to play with the above suggestions ....
On 2026-11-17 6:56 a.m., Gandalf Corvotempesta via dovecot wrote:
Il giorno mar 17 nov 2026 alle ore 12:50 Paul Kudla via dovecot <dovecot@dovecot.org> ha scritto:
ok i get the question however the users email address and password is pretty much a world wide standard more for simpliciy then anything else
logging and acting on hack attempts (what i do) works better (i blacklist the offending ip in real time)
i get for extra security you might want to add a seperate username for auth
Well, the email address is mostly a "public" info, hiding the username means that an attacker has to brute-force the password AND the username. As you can't, most of the time, use custom username on online services and their username are almost every time your email address, in fact, a service compromission also expose your mail username.
dovecot is very flexable on db lookup's against a user, you will need to add a column for the new login name and have to alter the dovecot sql query on login to look at the username auth field but then return the data as per normal aka username@domain etc.
That's what i did. I've changed the password query (not the user query) in the "WHERE" caluse. something like:
SELECT email AS user, .......... WHERE username = '%u'
Previously it was
SELECT email AS user, .......... WHERE email = '%u'
I'm able to login, but to a new mailbox called with my username
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
--
Thanks - Paul Kudla (Manager SCOM.CA Internet Services Inc.)
Have A Happy Tuesday AND Happy Sucessful 2026 !
Scom.ca Internet Services <http://www.scom.ca> 104-1009 Byron Street South Whitby, Ontario - Canada L1N 4S3
Toronto 416.642.7266 Main 1.866.411.7266 Fax 1.888.892.7266 Email paul@scom.ca