What is the purpose of a secondary email address

I’d like the system to try secondary email address if the first keeps bouncing.

Is this possible? if not, what is the purpose of the secondary email address in Discourse?

1 Like

When a user replies to a Discourse post via email from the secondary address, the message gets posted instead of rejected due to unknown user.

2 Likes

Do you mean when a forum doesn`t use email for topics, then secondary email is totally useless and it can’t be used as OP asked, even not for secondary login purposes?

If so then it is more or less just noise for users (yeah, I know — secondary ones are there if used SSO options as Microsoft, Google etc.)

The initial discussion about this is here: Two emails for one user. It continued here: Additional email address per user account support.

I think it was mainly implemented to deal with posting to Discourse via email for the case where users have multiple email accounts that they post from.

There isn’t anything in place that would cause Discourse to attempt to send an email to a secondary email address when emails sent to the primary email address bounce. I can see how that could be useful for some cases.

Technically, secondary emails can be used to find a user any time Discourse attempts to find a user from an email address with User.find_by_email

Users can login to Discourse using their secondary email address.

When an external auth provider is used for logging into Discourse, users can be found from their secondary email address based on the email address that’s provided by the auth provider.

Interestingly, if the auth overrides email site setting is enabled and the site’s external auth provider supplies the user’s secondary email, the secondary email becomes the primary email and the original primary email is destroyed. This case used to trigger a login error, so the behaviour seems to be intentional. I just spent way too long tracking down where it happens: https://github.com/discourse/discourse/blob/main/app/models/user.rb#L1602-L1620. (The old primary email is destroyed when the user is saved.)

4 Likes

This is important so that if main e-mail fails, an administrator or mod could then attempt to contact account holder manually with secondary e-mail?

Otherwise typically an account would be terminated if there is no valid e-mail address. However some e-mails come back as being undeliverable just temporarily if someone has past-due payments for that.

It definitely adds a bit of flexibility. The case of a user loosing access to the email address they used to create their Discourse account is a tricky one to deal with.

Yeah, that can be difficult to authenticate someone claiming to have an account but doesn’t have access to main e-mail or remember password. I put in second e-mail for my account here that uses different servers so hopefully if there is a problem with main one the other will work.