I'm sorry if this is something simple but I can't find an answer anywhere.

I'm having a problem with people who have set up email notifications for content and comments where the email notification appears to be sent by me rather than the content poster so when these people hit reply their reply is sent to me. I'd like to either change it so that the from field is the posters email or just disable the feature entirely. Like I said I've been unable to find an answer for either solution so any help would be greatly appreciated.

-Erik

Comments

argash’s picture

I've spent all night trying to find a solution with still no luck anyone else have a clue what I need to do?

argash’s picture

ok best I can tell is it's related to on of the OG modules but I still cant find where to fix it. Does anyone have any ideas?

aasarava’s picture

I had to track this down myself recently, but for a slightly different reason. Here's what I found:

In og.module, there's a function called og_mail($type, $obj). At the bottom of this function, at line 1737, you'll see the following code:

drupal_mail('og_mail', $row->mail, _og_user_mail_text('og_new_node_subject', $variables), _og_user_ma        il_text('og_new_node_body', $variables), $obj->name. " <$sitemail>", $groupheaders);

The reason the email is getting sent out with the user's name, but your site's email address, is all due to this bit of the code:

$obj->name. " <$sitemail>"

You really want to change $sitemail with the email of the user who posted the item. Now, if you're comfortable making a hack to the module itself, you could probably just replace that bit of code with this:

$obj->name . ' <' . $obj->mail . '>';

BUT, note that $obj->mail isn't set on its own, so you'll have to add code to do that somewhere earlier in the og_mail function. You might add something like this right above line 1737:

if (isset($account->mail)) {
  $obj->mail = $account->mail;
} else {
  $obj->mail = $sitemail; //set it to your site's general email if the post was made by an anonymous user
}

I haven't tested this myself, but hopefully this gives you an idea of what you need to do. Also, note that hacking the og module itself means you'll have to be careful should you decide up to upgrade the module later (you could wipe out your changes.)

Good luck,
-A

PS: You might want to keep an eye on this discussion with the module maintainer: http://drupal.org/node/174045

emilyf’s picture

aasarava, thank you so much for this! I posted to that discussion and within two hours you had this solution, so I really appreciate it. It works perfectly! I hope that at some point in the near future this can get included in OG as an option, but until then this is a very easy solution.

Now if I could just figure out how to get group by content type view on the OG home pages, I would be home free!

aasarava’s picture

No problem. Glad it works!