Hi,

I have a website where specific users with specific roles can post news. How to do to have these users receiving an email when somebody comments one of their articles ?

For example :
- john post a new article
- a user posts a comment on the new john's article
- john receive a notification by email

With trigger module and an action, I can send a mail to somebody when new comment is posted. But I don't know how to send the mail to the author of the commented article...

Thank you for your help
Regards

Comments

LR’s picture

Thank you for your answer. Unfortunately, the documentation doesn't indicate how to do what I want.

The notify module seems to send periodic emails. What I want is emails sent to authors only when a new comment is posted to their articles.

WorldFallz’s picture

"doesn't indicate how to do what i want" isn't very useful to providing assistance. Core triggers and actions can do this, what specifically is the issue?

LR’s picture

As I said in my first post, with core triggers and actions, I can send an email to a specific address when a new comment is posted on any article. But I don't know how to send an email to the author of an article when this article is commented.

Thank you for your help

Edit : precision : I have a few authors. I am responsible of creating their users and rights, they cannot register themselves. After that, they can write articles on specific taxonomy terms and should receive notifications when their articles are commented.

WorldFallz’s picture

First setup a new advanced action for "tokenized email", set the recipient to the '[author-mail]' token and configure the rest as desired. Then go the triggers page and add a new trigger for the 'after new comment' event and select the action you just created.

LR’s picture

Thank you. I can't find "tokenized email" in the advanced actions box. Should I add a module ?

marquardt’s picture

You probably need the token module. This is listed as one of the requirements for notifications...

WorldFallz’s picture

yep-- if you're not using the token module that's probably why you can't get it to work.

LR’s picture

I installed and enabled token and token actions modules.

I could create an advanced action for tokenized email. I could associate this action to the trigger "save new comment". I tried to put [author-mail] in the receipient field but I didn't receive any mail when I commented one of my articles. I put my email address in the receipient field and [author-mail] in the body. I received the mail but the mail body contains [author-mail] instead of my own address.

What's wrong ?

Thank you both for your help.

WorldFallz’s picture

I'm not sure why it's not working for you-- i just verified it works perfectly using the '[author-mail]' token for recipient on my d6.11 site. maybe double check the email of the post author and make sure it's specified correctly and works outside of drupal?

LR’s picture

I retried. In the configuration of my advanced "send tokenized email" action, I put this :
Description : Send tokenized e-mail for new comment
Receipient : LR@mydomain.com
Subject : new comment on your article
Message body :
==============
Hi [author-name] ([author-mail]),

A new comment has been posted on your article ([title]) :

[comment-title]

[comment-body]
==============

And here is the mail à received when a new comment is posted :
==============
Hi [author-name] ([author-mail]),

A new comment has been posted on your article ([title]) :

*test comment*

here is my comment !
===============

Are you sure it is different for you, even if the email is sent when a new comment is posted ?

Thank you again for your help.

WorldFallz’s picture

Just tested again-- copied and pasted your message body directly into the action. Works perfectly-- tokens are replaced with the correct info. I'm using d6.11 & the dev version of token.

LR’s picture

Maybe a problem with token... my version is 6.x-1.11. I am not sure if it would be a good thing to install the dev version in my website :S

Maybe I will try.

LR’s picture

The dev version works.

Is there a place where I could describe the process to have authors notified by email when new comments are posted on their articles ? I think that should be a frequent question, with a "complex" solution.

Thank you for your help

WorldFallz’s picture

Sorry about that-- I didn't realize it was something that was a function of using the dev version or I would have said so earlier.

GREAT idea about writing it up-- I'd probably add it to the howto section: http://drupal.org/handbook/customization/howto.

LR’s picture

I quickly did this : http://drupal.org/node/455042

WorldFallz’s picture

excellent-- short and sweet. Thanks for contributing!

marquardt’s picture

You could also raise an issue in the issue queue for the module. Then again, as it ha been fixed in the dev-version, there might already be an related issue. Searching the issue queues is often A Good Thing when problems arise...;-)

Oh yeah, this one possibly. It says that a patch was committed to to the repository in late march; the dev version is younger than that, the normal one isn't... so take the -dev version.

LR’s picture

I think I understood. I tried to put tokens related to comments ([comment-title] and [comment-body]) in the email's body. That worked.

I think tokens are context related and article's tokens aren't available in comments context. So, how could I send a mail to the author of an article when a comment is posted on his article ?

Would the notifications module be the solution ? If yes, please tell me how, I am trying but don't understand the way it works...

netentropy’s picture

does this send an email when the comment is created or approved?

freelylw’s picture

Trigger + Action doesn't define the content type, once it setup, all content type has the same function which we don't want. How can I get this email function for only certain content type ?

Thanks

WorldFallz’s picture

You can specify conditions if you use the rules module.