Hi,
I have some problem with reading smtp settings (only for this).
With a logged user in a Tenant :
SettingManager.ChangeSettingForTenant(AbpSession.GetTenantId(), Abp.Net.Mail.EmailSettingNames.Smtp.Host, input.SmtpHost);
writes correctly in database:
Id CreationTime CreatorUserId LastModificationTime LastModifierUserId Name TenantId UserId Value 10154 2020-01-27 11:03:51.4605249 4 NULL NULL Abp.Net.Mail.Smtp.Host 2 NULL smtp.my.domain
But, when I read the same value with
SmtpHost = SettingManager.GetSettingValueForTenant(Abp.Net.Mail.EmailSettingNames.Smtp.Host, AbpSession.GetTenantId()),
and AbpSession.GetTenantId() return 2,
I obtain 127.0.0.1 the is the default value.
Every other my setting works fine. There is something I'm missing?
ANZ 7.1.0 with Angular and Core 2
Thank you
10 Answer(s)
-
0
-
0
Hi @demirmusa
I'm sorry by I think that the expected behaviour is to obtain the Tenant value (smtp.my.domain) and not the Host value (127.0.0.1).
The Tenant's value is correctly written on database.
-
0
Hi @ivanosw1
Is your app multi tenant or single tenant ?
-
0
Multi tenant.
I'm trying to debug the source code but I'm not able to set correctly VS based on this documentation https://aspnetboilerplate.com/Pages/Documents/Debugging. No pdbs are founded :'Abp.AspNetZeroCore.dll'. Cannot find or open the PDB file.' But this is another issue.
-
0
So the main problem is, your tenant db and host db is different. When you set
Abp.Net.Mail.EmailSettingNames.Smtp.Host
setting tosmtp.my.domain
for the tenant, it stores setting in tenant db. But then when you try to get the value it returns a value from host db, That's why it returns default value in that case?Am I wrong?
-
0
Yes, exactly.
-
0
Alright. Thanks ivanosw1. Let me check it.
-
0
Thank you. Just one clarification: -> Your tenant db and host db is different.
No, host and tenant are on the same database.
-
0
Alright, I think it is because you dont allow tenant to change email. Set AbpZeroTemplateConsts.AllowTenantsToChangeEmailSettings to
true
. -
0
Thank you @demirmusa, the problem is solved.