1

I'm working in drupal 7 and I've configured the rules module to send emails you specific user roles when content is created. For some reason I'm getting inconsistent results, sometimes not receiving any emails. Any insight to why rules isn't generating emails would be helpful.

Here's my Rule:

{ "rules_announcements" : {
    "LABEL" : "Announcements",
    "PLUGIN" : "reaction rule",
    "WEIGHT" : "10",
    "OWNER" : "rules",
    "TAGS" : [ "announcements" ],
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert--announcements" : { "bundle" : "announcements" } },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "announcements" : "announcements" } }
        }
      }
    ],
    "DO" : [
      { "mail_to_users_of_role" : {
          "roles" : { "value" : { "5" : "5", "4" : "4" } },
          "subject" : "Announcements: [node:title]",
          "message" : "\u003Cp\u003E[node:title]\u003C\/p\u003E\r\n\u003Cp\u003E[node:field_announcement]\u003C\/p\u003E\r\n\u003Cp\u003E[node:body]\u003C\/p\u003E\r\n\u003Cp\u003E[node:url]\u003C\/p\u003E",
          "from" : "[site:mail]"
        }
      }
    ]
  }
}
  • Check your spam box, maybe they are getting sent there. – No Sssweat Jun 20 '18 at 10:21
  • No luck, I’ve checked there. – Chris Gatherer Jun 20 '18 at 10:36
  • Are your e-mails encrypted? Also try using mail logger module to see if the e-mails are being sent. Perhaps your e-mail host is blocking your domain's e-mail as it thinks you're a spammer. For testing purposes you could send your e-mails to anythingyouwant@mailinator.com there is no anti-spam here from my experience, so simply check the inbox name that you makeup. – No Sssweat Jun 20 '18 at 11:09
  • would it also help to use the SMPT module? – Chris Gatherer Jun 20 '18 at 11:22
  • 2
    everything @NoSssweat (bonjour ...) wrote is correct. But unless you include an export of your rule in your question, it's a waste of time for anybody trying to guess how your rule might look like ... – Pierre.Vriens Jun 20 '18 at 19:59
1

Attempt to answer this part of your question:

Any insight to why rules isn't generating emails would be helpful.

I doubt that Rules is the culprit ... and that it is rather something in actually sending the eMails. To verify this, just add a Rules Action to "Show a message" (as the very first Rules Action), and with actual content something similar to the subject / message body as what you have already in the Rules Action to send an eMail. Pretty sure that each time you'll get such extra message shown on your site. If it does indeed, you found a confirmation that there is nothing wrong with your rule itself.

However, just looking at the subject / message body of the eMail you want Rules to send: make sure to also verify that all those tokens (such as node:field_announcement) are available (not blank).

PS: a completely different explanation might be related to your event "after saving content", whereas the saving actually happens ... "before saving content". To verify if that's what your issue is about, replace your Rules Action by an appropriate Rules Component (which does the same thing), and actually "schedule" that Rules Component (using the rules Scheduler) to run after just a few seconds or minutes (at that time, for sure the save will have been completed).

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.