docusealco / docuseal

Open source DocuSign alternative. Create, fill, and sign digital documents ✍️
https://www.docuseal.co
GNU Affero General Public License v3.0
6.09k stars 428 forks source link

Allow smtp configure without requiring smtp user #23

Closed DevKyleS closed 1 year ago

DevKyleS commented 1 year ago

Please allow an SMTP configuration to be saved without forcing a smtp user to be defined

Related code

AlexandrToorchyn commented 1 year ago

@DevKyleS We still need some way to determine whether the SMTP configs via ENV should be triggered or not. I assume your local mail server is not authenticated via the username and password - in this case can we make SMTP_ADDRESS ENV var mantadory to enable SMTP configs?

if ENV['SMTP_ADDRESS''] 
   config.action_mailer.delivery_method = :smtp 
   config.action_mailer.smtp_settings = { 
     address: ENV.fetch('SMTP_ADDRESS', nil), 
     port: ENV.fetch('SMTP_PORT', 587), 
     domain: ENV.fetch('SMTP_DOMAIN', nil), 
     user_name: ENV.fetch('SMTP_USERNAME', nil), 
     password: ENV.fetch('SMTP_PASSWORD', nil), 
     authentication: ENV.fetch('SMTP_AUTHENTICATION', 'plain'), 
     enable_starttls_auto: ENV['SMTP_ENABLE_STARTTLS_AUTO'] == 'true' 
   }.compact 
 end 
DevKyleS commented 1 year ago

@DevKyleS We still need some way to determine whether the SMTP configs via ENV should be triggered or not. I assume your local mail server is not authenticated via the username and password - in this case can we make SMTP_ADDRESS ENV var mantadory to enable SMTP configs?

if ENV['SMTP_ADDRESS''] 
   config.action_mailer.delivery_method = :smtp 
   config.action_mailer.smtp_settings = { 
     address: ENV.fetch('SMTP_ADDRESS', nil), 
     port: ENV.fetch('SMTP_PORT', 587), 
     domain: ENV.fetch('SMTP_DOMAIN', nil), 
     user_name: ENV.fetch('SMTP_USERNAME', nil), 
     password: ENV.fetch('SMTP_PASSWORD', nil), 
     authentication: ENV.fetch('SMTP_AUTHENTICATION', 'plain'), 
     enable_starttls_auto: ENV['SMTP_ENABLE_STARTTLS_AUTO'] == 'true' 
   }.compact 
 end 

That sounds sufficient as an address will always be defined when used.

DevKyleS commented 1 year ago

I just confirmed release v1.0.4 resolves this sufficiently, this can be closed, thank you.

ovizii commented 1 year ago

I'm sorry for this blonde question, but how is this solved? (I am running a local mail proxy on 10.10.10.10 which then safely proxies my outgoing emails) I am running docuseal locally via docker-compose. I have not set any .env variables regarding email. If this is required, does anyone have a link to a sample .env file please?

I am trying to save and am told that the Username field needs to be filled in. image

DevKyleS commented 1 year ago

@ovizii The ENV variable names can be found in this file with the last parameter being the default value if not set.

Even with mine configured, I do not see the values in the Email page like you've screenshotted, a bug I'm sure, but the functionality is working for me (eg, forgot password email was received).

ovizii commented 1 year ago

Thanks for the pointer. I found those variables, but you misunderstood, what you see in the screenshot are the values I manually introduced on that screen, I had not set any via variables.

So having found the variables you linked are these the right settings for using a SMTP server on 10.10.10.10 port 25 without any authentication?

SMTP_ADDRESS=
SMTP_PORT=25
SMTP_DOMAIN=10.10.10.10
SMTP_USERNAME=
SMTP_PASSWORD=
SMTP_AUTHENTICATION=none
SMTP_ENABLE_STARTTLS_AUTO=false

I'm also confused why I can set these SMTP settings via variables AND via the GUI. If I set them via GUI I am forced to enter a user/password. Also, if I were to do that, would the GUI settings override the env variables?