0

I have successfully set up email notifications on my client's blog for administrators when new comments are posted and am now trying to set it up to send a thank-you email to the poster of the comment as well. I set it up using triggers and actions as described here.

I put in [comment:author:mail] in the "Recipient" field on the action configuration form as suggested in the note right below that field, but it seems that it never sends the email. I initially tested it using my own email address and it worked fine, then I posted a comment as an anonymous user using two different email addresses of mine but never received an email. Why is [comment:author:mail] not working? I'm using other variables in the body of the email (e.g. [comment:node:title]) and they're working fine.

I tried using Maillog as @tenken suggested below, which verified that the problem isn't with mail delivery but rather with the email not being populated correctly:

Here's a screenshot that shows the email to the administrator is working correctly, but not the thank-you email:

enter image description here

1

The anonymous user account doesn't have an email address to send to. You will want to use the value of the field that collects the email address instead of author:mail.

7
  • Thank you. How would I access that field? Since I didn't get a solution here after several days, I also posted this on StackOverflow where this answer pointed out the same thing you did; do you happen to know the answer to my follow-up question there? Aug 15 '14 at 17:00
  • Which is: "With regard to a custom field, there is already an email field that commenters see, so will I need to hide the default field in order to avoid having 2 email fields show up once I create the custom one?" Aug 15 '14 at 17:01
  • I didn't have to create a second email field for comments, but I did have to create one in the first place. That may be because anonymous users have permission to create comments on my site. (People -> Permissions -> Comments -> Post Comments)
    – faerysteel
    Aug 15 '14 at 17:29
  • And in my case, I can access that field in Rules with comment:field-email
    – faerysteel
    Aug 15 '14 at 17:38
  • I allowed anonymous commenters to leave an email by setting the "Anonymous commenting" setting for the "Blog" content type to "Anonymous posters may leave their contact information". So I'm guessing I should change that back to "Anonymous posters may not enter their contact information" and create a custom email field instead? Aug 15 '14 at 19:18
1

This question can be very hard to answer -- email is tricky as PHP just hands off your email to the underlying/remote mail system. I suspect nobody can tell you exactly what's wrong without in-depth examination of your setup.

But, the Mail Developer module will allow you to "try" to send and log raw emails without actually sending them, you can likely look for differences between mails that do send -- and the emails you think are not sending correctly.

Maillog provides an easy possibility to log all Mails for debugging purposes. It's possible to prevent the mails to being sent, so there is no need for an extra mail server to test the mail functionality of other modules or the drupal core. Additionally you can immediately display the mail through the devel dpm() facility.

If you like to upgrade from a previous dev release, please disable, uninstall and reinstall again. There's no upgrade procedure yet.

Also see the similar modules on the project page -- for additional tools to debug and resolve your problem.

2
  • Thanks, I'll look into this...but one of the email addresses I used was the same as the one I had successfully tested by hard-coding it into the email field, so I was thinking that the [comment:author:mail] variable wasn't working correctly...thanks for the suggestion in any case. Aug 9 '14 at 1:14
  • As I suspected, email delivery isn't the problem - see the screenshot I added to my question. Aug 9 '14 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.