Is it possible to make usernames as email from field

(Jeff Wong) #1

Currently a user’s full name field is being used as the from field in emails. Is there a way to configure it so that it picks the username as the from field?

Pretty much the opposite request to the suggestion here:

My users are a fun community that are using the ‘full name’ field as a sort of custom silly title field, as a way to mimic what they could do back on old phpbb forums. It works great, but some of the titles don’t immediately give way who is posting for this use case, and username would be much more helpful in email digests.

(Jeff Wong) #2

A naive implementation would be something like the following:

(Jeff Atwood) #3

We’d probably need a site setting for this since “community is using full name field for hilarity” can’t be detected algorithmically… but I agree with the need.

(Jeff Wong) #4

You might have missed the PR thrown your way; that’s exactly what I suggested in there :wink:

(Sam Saffron) #5

Hmm too many settings are in play here, going to leave the discussion here as opposed to PR cause I want to get names right…

(   !SiteSetting.username_in_from && 
     SiteSetting.enable_names && 
     SiteSetting.display_name_on_posts &&

This is getting very confusing, names on posts now has very strong ties to name in from.

Instead perhaps

SiteSetting.enable_names && SiteSetting.display_name_on_emails &&

and sort out sane defaults.

(Jeff Wong) #6

That’s why I just threw it your way to see what you guys thought about it.

I do like your structure being tied to the name field for all the boolean logic. I’ll update the PR in a sec.

edit: updated. But what do you think about display_name_as_email_from (or display_name_as_email_sender)? display_name_on_emails implies that if it’s disabled, a name won’t appear anywhere in the email, but right now, it still would appear in the email body. I want to keep the silly names in the body, but just swap out the email’s from header.

(Sam Saffron) #7

Sorry, yeah getting names right here is difficult… .


Should mean anywhere we render a post we display a name (if enable_names is on)


Should mean anywhere we render an email from we display a name (if enable_names is on)

My comment is mostly about decoupling display_name_on_posts from the decision of what to put in the FROM field cause it is confusing.

(Jeff Wong) #8

I like display_name_on_email_from, I think that’s clear in its intention.

Edit: Pushed changes; it’s now named SiteSetting.display_name_on_email_from.

(Sam Saffron) #9

This is now merged in, closing :slight_smile:

(Sam Saffron) #10