diff --git a/README.md b/README.md index 2a71886b3..c8139f81a 100644 --- a/README.md +++ b/README.md @@ -508,6 +508,7 @@ GOTRUE_SMTP_HOST=smtp.mandrillapp.com GOTRUE_SMTP_PORT=587 GOTRUE_SMTP_USER=smtp-delivery@example.com GOTRUE_SMTP_PASS=correcthorsebatterystaple +GOTRUE_SMTP_INSECURE=false GOTRUE_SMTP_ADMIN_EMAIL=support@example.com GOTRUE_MAILER_SUBJECTS_CONFIRMATION="Please confirm" ``` @@ -532,6 +533,10 @@ If the mail server requires authentication, the username to use. If the mail server requires authentication, the password to use. +`SMTP_INSECURE` - `bool` + +If the mail server requires TLS, but does not provide a valid certificate, you can set this to `true` to skip certificate verification. Defaults to `false`. + `SMTP_MAX_FREQUENCY` - `number` Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email. The value is the number of seconds. Defaults to 900 (15 minutes). diff --git a/app.json b/app.json index 486865630..589f08044 100644 --- a/app.json +++ b/app.json @@ -21,6 +21,7 @@ "GOTRUE_SMTP_HOST": {}, "GOTRUE_SMTP_PASS": {}, "GOTRUE_SMTP_PORT": {}, + "GOTRUE_SMTP_INSECURE": {}, "GOTRUE_MAILER_SITE_URL": {}, "GOTRUE_MAILER_SUBJECTS_CONFIRMATION": {}, "GOTRUE_MAILER_SUBJECTS_RECOVERY": {}, diff --git a/example.env b/example.env index e408dcb40..36bbee674 100644 --- a/example.env +++ b/example.env @@ -19,6 +19,7 @@ PORT="9999" GOTRUE_SMTP_HOST="" GOTRUE_SMTP_PORT="" GOTRUE_SMTP_USER="" +GOTRUE_SMTP_INSECURE=false GOTRUE_SMTP_MAX_FREQUENCY="5s" GOTRUE_SMTP_PASS="" GOTRUE_SMTP_ADMIN_EMAIL="" diff --git a/internal/conf/configuration.go b/internal/conf/configuration.go index 1f81f6b7a..bcd43d7ed 100644 --- a/internal/conf/configuration.go +++ b/internal/conf/configuration.go @@ -337,6 +337,7 @@ type SMTPConfiguration struct { Host string `json:"host"` Port int `json:"port,omitempty" default:"587"` User string `json:"user"` + Insecure bool `json:"insecure,omitempty" default:"false"` Pass string `json:"pass,omitempty"` AdminEmail string `json:"admin_email" split_words:"true"` SenderName string `json:"sender_name" split_words:"true"` diff --git a/internal/mailer/mailer.go b/internal/mailer/mailer.go index ff19239d8..d9da59dab 100644 --- a/internal/mailer/mailer.go +++ b/internal/mailer/mailer.go @@ -66,6 +66,7 @@ func NewMailer(globalConfig *conf.GlobalConfiguration) Mailer { Port: globalConfig.SMTP.Port, User: globalConfig.SMTP.User, Pass: globalConfig.SMTP.Pass, + Insecure: globalConfig.SMTP.Insecure, LocalName: u.Hostname(), From: from, BaseURL: globalConfig.SiteURL,