Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send emails only from allowed senders and replace From with Sender in Forms #6231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SegiNyn
Copy link
Contributor

@SegiNyn SegiNyn commented Mar 14, 2024

No description provided.

@SegiNyn SegiNyn changed the title Send emails from only allowed senders and replace From with Sender in Forms Send emails only from allowed senders and replace From with Sender in Forms Mar 14, 2024
@ThiefMaster
Copy link
Member

ThiefMaster commented Mar 15, 2024

Is it really necessary to change the APIs internally? At least what I had in mind was simply changing the logic in the emails module to determine how to use From and Reply-to and only changing the form label in the various other places...

Also, I think we agreed to "name via Indico" <noreply...> in the From, and not using the site title in a very generic way.. Nevermind, that was just an early return where I saw that.

@SegiNyn
Copy link
Contributor Author

SegiNyn commented Mar 15, 2024

Is it really necessary to change the APIs internally? At least what I had in mind was simply changing the logic in the emails module to determine how to use From and Reply-to and only changing the form label in the various other places...

I saw that you already had a function _rewrite_sender that makes changes to the From address that's why I removed that and added a new function. And I thought it was better to make the changes before creating the EmailMessage. Also, to be sure where in the emails module did you have in mind? do_send_email?

@SegiNyn
Copy link
Contributor Author

SegiNyn commented Mar 15, 2024

The changes to the names to sender_address instead of from_address isn't actually necessary but it makes it obvious to developers as well not just the users as is the case if only the label is changed.

Comment on lines +172 to +174
from_address = _get_actual_sender_address(sender_address)
if sender_address and from_address != sender_address:
reply_address |= {sender_address}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if (even though the RFC allows it) using multiple reply-to addresses is a good idea.

I wonder whether we shouldn't clean up the API of make_email to be less ambiguous. One possibility would be to have only the sender_address arg, and completely get rid of the reply_address options - and then rely on the existing logic to determine whether the address goes in From or Reply-to.

Or alternatively, to make the PR less invasive, keep the API mostly as it is, but simply make an explicitly specified reply_address override the one that may otherwise be taken from the from_address.

I'll think about it and try around a bit on my dev instance...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion because in our case we use the reply_address option in make_email since we were converting all from_address to reply_address. But there are some notification emails functions which are explicitly passing the reply_address address to the make_email function. So maybe your second option would be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants