A user publishes new content to a group and a notification email is sent to group members. Sender is the username of the user who posted the content. However, the email address is the default address of the site. This is confusing as (at least my) users do reply to these emails thinking to contact the sender, but the email gets send to the site admin who has to forward it.
Also, having the username as the name of the sender can be confusing as members of large groups do not necessarily know the usernames of all members and could mistake the email for spam.

Match email-address and sender name to either admin of the site or the user who posted the content. This could be an option for the admin to decide as it would of course mean that the email address of the user is send out, so the default should be admin name and email address.

#10 og_email_from_settings.patch4.71 KBaasarava


moshe weitzman’s picture

Status: Active » Closed (works as designed)

drupal does not reveal user email addresses anywhere .. use hook_mail_alter to do what you want.

TfR75’s picture

No, it does not reveal email addresses - it would if the notifications were send out using the email address of the user who posted that new content, which was what I was getting at.

I will have a look at hook_mail_alter, thanks for that!

TfR75’s picture

Status: Closed (works as designed) » Active

I have been thinking about this issue some more and I do think that hook_mail_alter is not the ideal solution as the current behaviour does not seem to be ideal (beyond what I might want for my site): As the sender and the email address used (i.e. name of the user and email of the site) do not match, it can (and has repeatedly on my site) lead to members of groups replying to these emails in the assumption to contact the user who posted the content, not the site admin.

Suggestion: Have the name of the site as default sender name and drop the name of the user (who is mentioned in the email anyway) or at least make it optional.

moshe weitzman’s picture

there is a reason to put the name of the poster there. some posters author intelligent work and some author crap. it helps to know the difference without opening the msg.

anyway, make a patch and then we can discuss.

TfR75’s picture

I agree that having the name of the poster as the sender is useful for filtering (although it is also mentioned in the email itself). Having the site name as sender prevents people from replying to the site admin and may help those who can mistake such emails for spam. I think there is a clear case for having the option to choose what is of more use for the respective site.

Unfortunately, my PHP skills are too limited to do this. I am happy to help with testing or other tasks, but this may not be enough.

moshe weitzman’s picture

after some more thought, i would accept a patch which gave admin control over how From appears in these notifications.

moshe weitzman’s picture

Category: bug » feature
emilyf’s picture

I would like to add that all of my sites would benefit from this option as well ..... choosing whether or not to have emails sent from site admin with name/matching email OR from the actual user with name/matching email.

My skills are also limited in that I cannot code this myself, but I want to put it out there that this will be a very useful feature. I hungrily await.

aasarava’s picture

Hi all,

I had the same issue with the incongruence between the user name and site email addresses, and I noticed that at least one other Drupal user did too. I don't have a full patch, but I've posted a message in the forums describing one possible og hack for site operators who don't mind revealing their users' email addresses in this outgoing message:

Furthermore, I've noticed that there's a problem with the way the og_mail function inserts angle brackets (<>) around the site email. One some sites, the admin sets the site email like so:

mysite admin <admin@mysite.com>

The problem shows up when og_mail uses that directly and tries to wrap it again with extra brackets and ends up with something like this:

username <mysite admin <admin@mysite.com>>

It seems that if og_mail is going to use the site email address, then it shouldn't try to modify it, as this could cause formatting problems in the outgoing email.


aasarava’s picture

Version: 5.x-3.1 » 5.x-4.0-rc5
Status: Active » Needs review
4.71 KB

Here's a patch as requested that will allow admins to specify the format of the "From:" field on new content notifications. The options are:

  1. Username + Admin Email: "username" <adminemail@sitedomain.com> [default]
  2. Site Name + Admin Email: "Site Name" <adminemail@sitedomain.com>
  3. Admin Email: adminemail@sitedomain.com
  4. Username + User Email: "username" <useremail@userdomain.com>

The values for "Site Name" and "Admin Email" are taken straight from the values set by the admin in the Site Configuration.

Option #3 has the benefit of simply reuising the "Admin Email" value as-is, without doing any manipulation or adding extra characters. This is beneficial for site admins who want to enter a name along with the email when filling out the "Admin Email" portion of the configuration form. For instance, if the value is set to "our site" <info@oursite.com>, then the "From:" field won't get mangled when og processes it.

moshe weitzman’s picture

Status: Needs review » Fixed

Thanks for the patch ... I ended up committed a very different version which enables admin to specify a pattern for the from email address and then the proper tokens are replaced with real values. This matches how we do outbound emails.

Anonymous’s picture

Status: Fixed » Closed (fixed)