Mail deferred due to unresolved recipient

Hello together

Being freshly migrated to kopano 8.4 from Zarafa after years of use, I was very satisfied so far. After a couple of days, suddenly yesterday one of my mailboxes did not accept mails anymore while others do still as designed. Error message in Mail.log is:

Aug  4 10:29:22 kopano postfix/local[9549]: 20FC28ABD: to=<user1@kopano.zuhause.xx>, relay=local, delay=0.22,
delays=0.07/0/0/0.15, dsn=4.3.0, status=deferred (temporary failure. Command output: Unable to open logfile
 '/var/log/kopano/dagent.log' as user 'kopano' Not enough permissions to append logfile '/var/log/kopano/dagent.log'. 
Reverting to stderr. Fri Aug  4 10:29:22 2017: [ 9580] [error  ] M4LMsgServiceAdmin::ConfigureMsgService() 
MSGServiceEntry failed 80040111: logon failed Fri Aug  4 10:29:22 2017: [ 9580] [crit   ] CreateProfileTemp(): 
ConfigureMsgService failed 80040111: logon failed Fri Aug  4 10:29:22 2017: [ 9580] [warning] CreateProfileTemp failed: 
80040111: logon failed Fri Aug  4 10:29:22 2017: [ 9580] [error  ] Failed to resolve recipient user1 (1) Fri Aug  4 10:29:22 
2017: [ 9580] [error  ] ProcessDeliveryToRecipient(): ResolveUser failed 8004010f Fri Aug  4 10:29:22 2017: [ 9580] 
[error  ] Unable to deliver message to "user1", error code: 0x8004010F Fri Aug  4 10:29:22 2017: [ 9580] [error  ] 
ProcessDeliveryToSingleRecipient: ProcessDeliveryToServer failed 8004010f Fri Aug  4 10:29:22 2017: [ 9580] [error  ] 
main(): deliver_recipient failed 8004010f )

I am using dagent via lmtp. When I try this manually with

cat mail | dagent -vvv user1  

(yes this is pipe but not really relevant for the problem) I get

Thu Aug  3 22:57:02 2017: [ 6343] [error  ] Failed to resolve recipient user1 (1)
Thu Aug  3 22:57:02 2017: [ 6343] [error  ] deliver_recipient(): ResolveUser failed 8004010f
Thu Aug  3 22:57:02 2017: [ 6343] [error  ] main(): deliver_recipient failed 8004010f

When I do the same with the full EXTERNAL address name

cat mail | dagent -vvv user1@externaldomain.de

All is fine

 * Loading plugins started
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] ** Checking plugins in /var/lib/kopano/dagent/plugins
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * Loading plugins done
Thu Aug  3 22:58:06 2017: [ 6364] [notice ] Resolved recipient user1@externaldomain.de as user user1
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] Mail will be delivered in Inbox
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PostConverting processing started
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PostConverting processing done
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PreDelivery processing started
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PreDelivery processing done
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PreRuleProcess processing started
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PreRuleProcess processing done
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] Rule Rule1 doesn't match: 0x8004010f
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] Rule Rule2 doesn't match: 0x8004010f
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] Rule Rule3 doesn't match: 0x8004010f
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PostDelivery processing started
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * PostDelivery processing done
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * SendNewMailNotify processing started
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] * SendNewMailNotify processing done
Thu Aug  3 22:58:06 2017: [ 6364] [info   ] Delivered message to "user1", Subject: "<none>", Message-Id: , size 6

All the alias look imho also fine:

cat /etc/postfix/virtual_domains
user1@externaldomain.de user1
user1@kopano.zuhause.xx user1
user2@externaldomain.de user2
user3@externaldomain.de user3
webmaster@externaldomain.de user1
postmaster@externaldomain.de user1

Access to database with user1 is possible, user1 is there and config does not show any pecularities

I nevertheless assume a problem/challenge in the aliases. Can somebody provide some insight how dagent makes recipient resolution? or any other idea where to look further?

I am looking forward to your reply

Br br

EDIT: Meanwhile, I am somewhat more progressed in the analysis but not solution: Direct lmtp via telnet shows:

telnet 127.0.0.1 2003
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 2.1.5 LMTP server is ready
LHLO user1
250-SERVER ready
250-PIPELINING
250-ENHANCEDSTATUSCODE
250 RSET
MAIL FROM:<user1@kopano.zuhause.xx>
250 2.1.0 Ok
RCPT TO:<user1>
503 5.1.4 Destination mailbox address ambiguous

Is this then the kopano mailbox or is this on postfix level?

Hello @bringha ,

actually kopano-dagent does not resolve aliases, but expects the delivering process to either pass the username or the primary emailadress of the user to deliver the message to.

I would expect you problem to center around:

status=deferred (temporary failure. Command output: Unable to open logfile
 '/var/log/kopano/dagent.log' as user 'kopano' Not enough permissions to append logfile '/var/log/kopano/dagent.log'. 
Reverting to stderr.

seems your delivering process has not the same permissions, that kopano-dagent is running as already.

Thanks Felix,

I had that permission problem in earlier days a few times but believe to have it fixed; all other users can do with the same permission settings; as it can be seen in my edit, root cause seems to indicate in a somewhat different direction i.e.

Ambigous mailbox address!

how can I analyze further because kopano-admin does not show me any pecularities

Br br

HI @bringha ,

Destination mailbox address ambiguous

means that there are two mailboxes existing with the same email and the mail therefore cannot be delivered.

Hmmmm …

kopano-admin -l
User list for Default(4):
	Username	Fullname		Homeserver	
	--------------------------------------------------------
	SYSTEM		SYSTEM			Kopano	
	user1		user1 nachname	
	user2		user2 nachname		
	user3		user3 nachname			

and the long version

root@kopano:/etc/postfix# kopano-admin --details amavis
Username:		amavis
Fullname:		amavis
Emailaddress:		amavis@kopano.zuhause.xx
Active:			yes
Administrator:		no
Address book:		Visible
Auto-accept meeting req:no
Out Of Office:          disabled
Mapped properties:
	PR_EC_ENABLED_FEATURES	mobile; outlook	
	PR_EC_DISABLED_FEATURES	imap; pop3	
Current user store quota settings:
 Quota overrides:	no
 Warning level:		unlimited
 Soft level:		unlimited
 Hard level:		unlimited
Current store size:	0.06 MB
Groups (1):
	Everyone

root@kopano:/etc/postfix# kopano-admin --details user2
Username:		user2
Fullname:		user2 Nachname
Emailaddress:		user2@externaldomain.de
Active:			yes
Administrator:		yes
Address book:		Visible
Auto-accept meeting req:no
Out Of Office:          disabled
Last logon:		08/04/2017 11:50:26 AM
Last logoff:		08/04/2017 11:50:26 AM
Mapped properties:
	PR_EC_ENABLED_FEATURES	imap; mobile; outlook	
	PR_EC_DISABLED_FEATURES	pop3	
Current user store quota settings:
 Quota overrides:	no
 Warning level:		unlimited
 Soft level:		unlimited
 Hard level:		unlimited
Current store size:	840.30 MB
Groups (1):
	Everyone

root@kopano:/etc/postfix# kopano-admin --details user1
Username:		user1
Fullname:		user1 Nachname 
Emailaddress:		user1@externaldomain.de
Active:			yes
Administrator:		yes
Address book:		Visible
Auto-accept meeting req:no
Out Of Office:          disabled
Last logon:		08/04/2017 12:06:28 PM
Last logoff:		08/04/2017 12:06:20 PM
Mapped properties:
	PR_EC_ENABLED_FEATURES	imap; mobile; outlook	
	PR_EC_DISABLED_FEATURES	pop3	
Current user store quota settings:
 Quota overrides:	no
 Warning level:		unlimited
 Soft level:		unlimited
 Hard level:		unlimited
Current store size:	881.95 MB
Groups (1):
	Everyone