Basically you need one smtp connection for one domain and all users can use that same smtp configuration. If you even though need a specif smtp server for each user, you need a code change.
I think I didn’t write that I need separate SMTP server for each user. I would like all users to use the same SMTP server but they should be able to supply their own password.
I guess I have to code the change for that. I think I have to do that anyway because in the current setup of Dolibarr, the SMTP Password is not stored in encrypted form. So everybody with Admin privilege can see the SMTP Password set for the email account.