Generally, users’ public key certificates are stored on LDAP (directory server). If you are interested, you can check the information about LDAP online.
E-mail clients that support certificate encryption can generally set the LDAP address of the digital certificate.
When you send an encrypted email to user B, the email client will match the email address you sent to user B to the public key certificate of user B on LDAP to obtain and encrypt it (the process does not require manual intervention).
After user B receives the email, he can use his private key to decrypt it.