Skip to content

email: Use configuration email address in render func

Warren Gifford requested to merge github/fork/flyinprogrammer/as.fix_smtp into main

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:

  1. For regular SMTP: use email.smtp credentials prepopulated from the "dev-private".

  2. 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"
},
  1. Add a new valid email to your user settings.
  2. Receive the verification email.

Merge request reports

Loading