email: Use configuration email address in render func
Created by: flyinprogrammer
I'm disappointed Google SMTP let you send with an invalid From email address, nevertheless this should fix this.
Fixes regression in: https://github.com/sourcegraph/sourcegraph/pull/37255
Alternatively we could just add this back under the render:
m.From = conf.EmailAddress
and then we should probably stop setting From
in the render()
func, and update the tests not to validate the value of From
in the returned message.
Or if we don't like the render func relying on the conf
object, we could require the render to take a specified function parameter like, default email address, provided by the conf object in the Send()
func.
It's all entirely up to you guys and how you want to fix this.
Test plan
Manual e2e tests:
-
For regular SMTP: use email.smtp credentials prepopulated from the "dev-private".
-
For Google SMTP relay, change the site config:
"email.smtp": {
"authentication": "PLAIN",
"username": "<you>@sourcegraph.com",
"password": "<App password>",
"host": "smtp-relay.gmail.com",
"port": 587,
"domain": "sourcegraph.com"
},
- Add a new valid email to your user settings.
- Receive the verification email.