Royal-Society-of-New-Zealand / NZ-ORCID-Hub

The home of development for the New Zealand ORCID Hub
MIT License
13 stars 8 forks source link

Replace hardcoded support address with config variable #1283

Closed ghalse closed 3 years ago

ghalse commented 3 years ago

At the moment the orcid@royalsociety.org.nz email address is hardcoded into a number of error messages within the application.

This makes a new MAIL_SUPPORT_ADDRESS config option that allows the address to be set, whilst still preserving the existing hardcoded values as the defaults.

It also prefers to use the new MAIL_SUPPORT_ADDRESS as a default reply_to address rather than MAIL_DEFAULT_SENDER so that users replying to an email can reach somewhere sensible while bounces still go to a no-reply address.

nad2000 commented 3 years ago

If you set policies that authorize your relay for reply_to domain, that would be fine otherwise you might have a bad time.

On Fri, 6 Aug 2021 at 21:59, Guy Halse @.***> wrote:

@.**** commented on this pull request.

In orcid_hub/utils.py https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/pull/1283#discussion_r684112816 :

@@ -132,7 +132,7 @@ def send_email( recipient, cc_email=None, sender=(app.config.get("APP_NAME"), app.config.get("MAIL_DEFAULT_SENDER")),

  • reply_to=None,
  • reply_to=app.config.get("MAIL_SUPPORT_ADDRESS"),

I'm interested in why you think that? We've certainly never had that problem with other systems that use a noreply@ address from From: and a valid Reply-To:, and the config is quite common in e.g. mailing lists. But perhaps there's something peculiar about how this is being done that I don't understand?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/pull/1283#discussion_r684112816, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLI4S5SU2O3ZYLF2PRQQ3T3OW7FANCNFSM454VJ7EA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

nad2000 commented 3 years ago

@ghalse my bad! I must have got it confused with some other case when I couldn't get cleared messages; "reply-to" can be used with anything. I thoroughly tested it. Tho, there are a few missing bits - 1) set_headers overrides previous calls; 2) the environment parameters need to be added to docker-compose.yml if you are using composer. It's fixed now.