Binding setup mailer properties

For mailer i have an interface where system admin can fill mailer details which are saved to database (password encrypted). I want to bind setup mailer properties to the values from database. The only way i have found so far is to query for the data in the globals and then bind. which is what i have done as in the caption. (not tested).

I am wondering if this is how it is supposed to be done. Client does not want to expose his mail server credentials so hard coding is not an option. Also once these are put in globals it appears as in below caption, made available with every server connection.
des2
need some guidance and assurances…

I’m only adding smtp: true in the post request.

In my globals I check if smtp is true and then query the smtp details from the database.

CleanShot 2023-05-25 at 00.54.23

My mailer looks uses ENV variables if the above variables are not defined:

1 Like