Hi everyone,

I have several triggered rules which use the email function to notify users or administrators of changes on nodes. I checked the log reports and everytime a rule is executed the mail is logged as "successfully sent to..." .

But the recipient doesn't get any emails, i'm thinking maybe I missed something in the settings...

Need help thanks,

Issue fork rules-486168

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andrew_hoffi’s picture

I'm getting exactly the same problem, the logs show the rule being triggered but no e-mails are being sent through. Has anyone come up with the same problem? Or indeed even better a solution.

I'm trying to send e-mails to the current user and a fixed e-mail on the creation of a specific content type.

AlexisWilke’s picture

There are 3 email actions, exactly, which one do you use?

The one I use works... (i.e. "Send a mail to an arbitrary mail address")

Thank you
Alexis Wilke

Heilong’s picture

I have 2 different rules using these 2 different actions : "send a mail to all user of a role" mail which is sent to the administrator, and "send a mail to an arbitrary mail address" which is sent to a user I got from a cck field.

Is there any mail method associated to rules ?

AlexisWilke’s picture

The "send a mail to an arbitrary mail address" can be used with a direct email address which is what I use and that works for me.

I don't use CCK on that site so I could not test that right now. But for the role it looks good to me. It uses the drupal_mail() function. Maybe that does not work? Did you try to send yourself an email from your /contact form to see whether the mail flows alright?

profjk’s picture

**Subscribing**

Heilong’s picture

I'm using Webform module for my contact page, it's working, emails are sent and received properly. it doesn't work only for Rules

mitchell’s picture

Status: Active » Fixed

Since this isn't a known bug, the email actions should work fine. Please verify that your system can send emails using one of Drupal's internal features, such as "notify the user of the newly created account."

I'm guessing the problem is that your webserver is not configured to send emails, whereas the smtp module is a helpful workaround.

If you still need help with this, please reopen this issue and post an export of your rule.

AlexisWilke’s picture

mitchell,

#6 says that it works for him from Webform, but not from Rules... I'm not too sure why it would be any different, but that means there is something that does not work there.

Alexis

jenlampton’s picture

Status: Fixed » Active

I'm having a similar problem with "Send a mail to an arbitrary mail address" no emails are sent, no errors are logged. No success messages are logged either, I'm not sure where things are failing.
I'm running Rules and Token.

*edit* by changing the weight of this action to -2, my emails now send. very strange!

Jen

fago’s picture

Status: Active » Fixed

Be careful with *immediate* page redirects, I suppose they are the cause for your troubles.

RobertNelsonVance’s picture

I have experienced the same issue on two different sites now that I am working on. Neither are configured with the same modules and were installed individually.

I am using Rules configuration as follows:

Conditions
Created content is Some Content Type (created content)
AND
User has role(s) indent (acting user)

Actions
Send a mail to a user (acting user)
Add user role (acting user)
Remove user role (acting user)
Show a configurable message on the site

My issues is, for all intents and purposes, the same as described above - but my issue seems to be intermittent. I've created twenty or so new nodes and have received the email notification twice. I was hoping I could replicate these two successful emails to narrow down the problem by creating new nodes with the same data in title/body/cck fields as the two that actually went out, but this attempt also failed at sending emails.

I tried creating new Drupal accounts and received the account creating confirmation email. The site's contact form works properly as well. Furthermore, I have a number of other websites also running on this server and they have no problem sending their emails. Some of these are using workflow-ng on Drupal 5.x and it also works fine.

I tried switching email addresses in my test user account to see if it was the email and not Drupal. I tested three different email addresses for three different email servers (one was even Gmail). It doesn't seem to be on the recipient end.

I tried the aforementioned "-2" rule weight hack that jenlampton mentioned about in #9. I didn't have any success with this. Additionally I tried setting the "Send mail to a user" Action's weight to "-2" and that didn't solve the problem either. Maybe it was just intermittent success for her?

I also tried switching around the Action weights so that the "Send mail to a user" Action comes first or comes last - didn't make a difference.

Additionally, the "Successfully sent email" shows up in my Drupal log.

Thanks, Robert

fago’s picture

Hm, does the "Successfully sent email to " message hold the correct recipient? If so everything should have been fine, meaning that the mail was correctly sent by drupal_mail().

RobertNelsonVance’s picture

Yes, the recipient is correct in the log. And as mentioned above, infrequently the email is actually delivered.

Patroclas’s picture

I have this same issue as the original post. I note this issue is tagged as 'fixed'? Where is the fix please?

fago’s picture

Category: support » bug
Status: Fixed » Postponed (maintainer needs more info)

There is none. @Patrocias: Does mail sending else work fine on your site? Are you using php4?
For me mail sending works fine - so if there is a bug in rules mail sending you should try to reproduce the problem and to identify the cause. As when I can't reproduce it, I've no way to find the problem and fix it.

Patroclas’s picture

My site is sending emails from everything except rules.

I have configured a 'Send a mail to an arbitrary mail address' to send when content of a specific type is created.
I have removed all tokens from the configuration just to test it.
I have log entries showing successful sends, but nothing is being received.
The 'from' address is left as the site default.
The To: address is correct and is the same as for other successful messages.
There are no errors in my server logs.

Here is the rule

array (
  'rules' => 
  array (
    'rules_18' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_insert',
      '#label' => 'Issue report',
      '#active' => 1,
      '#weight' => '-2',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#type' => 'condition',
          '#settings' => 
          array (
            'type' => 
            array (
              'report' => 'report',
            ),
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#name' => 'rules_condition_content_is_type',
          '#info' => 
          array (
            'label' => 'Created content is Report an issue',
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#weight' => 0,
        ),
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Send a mail to an arbitrary mail address',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'subject',
              1 => 'message',
              2 => 'from',
              3 => 'to',
            ),
          ),
          '#name' => 'rules_action_mail',
          '#settings' => 
          array (
            'to' => '[email address removed]',
            'from' => '',
            'subject' => 'Isssue report',
            'message' => 'Content',
          ),
          '#type' => 'action',
        ),
      ),
    ),
  ),
  'rule_sets' => 
  array (
  ),
)

Would appreciate any help on this - thanks for your quick reply.

fago’s picture

hm, I still cannot reproduce it. I configured the action like yours but everything works fine. Do you have any modules installed that might hook into it and alter the mail? Is it working on a clean drupal install only having rules activated?

fago’s picture

Have you access to the server logs, does the mail appear there as others?

Patroclas’s picture

Nothing helpful in the logs. I will assume this is a problem somewhere on my system and take a further look. If I find anything I will report back here.

Thanks for your help.

capellic’s picture

I too am not receiving emails when I've instructed the event to send emails to all users in a role. Yes, this is on the "account create" condition and yes, I do have redirect as the last action. And yes, "Immediately issue the page redirect" is unchecked.

I added a "send to an arbitrary address" action to send to another one of my email address and that didn't work.

Then I removed the redirect action and then I got the email from the arbitrary email address action -- but not the "send to all users of this role" -- and yes -- there are two users in that role and they are valid email addresses.

(It should also be said that I'm seeing nothing in the recent activity log -- not even the successful send. I've checked the Rules config screens and I don't see anything turning on log messages -- though that would be *very* useful.)

So then I added a new redirect action and tested. OK, I am still getting the arbitrary email which is good but not getting the role email. (I am also receiving the standard notifications from Drupal that a new account was created.)

Next, I added a token to the body of the arbitrary email from one of the Content Profile nodes I had previously loaded --- yeah -- a small detail I left out! ;-) Then I tested and I *didn't* get the email. Huh, the token is the problem. Oh yes, the email that is supposed to go to the role is full of tokens, so we may be on to something here.

I then removed the token from the arbitrary email and tested. I didn't get the message. So, if it's being corrupted, it's being corrupted for good. I removed the email action and added a new one, tested and I received that one.

So, my conclusions at this point is that there is something wrong when including tokens.

Dinis’s picture

Getting very similar issues to those reported above, repeatable issue:

1. Creating a rule which notifies all users in a role upon a condition being met works fine when tested.
2. Add token values to the mail, the rule keeps working but the mail is no longer sent.
3. Add a new action to sent an email to someone (no tokens), new mail action works (old one still fails).
4. Add token values to body, mail fails again.

In all stages all other actions in the rule work correctly, the log does stop getting the "mail successful" event logged at the point mail stops working.

This is 100% repeatable for me and *only* where tokens are added to the mail to be sent.

In addition, removing tokens from the body does not repair the action, and it has to be deleted.

Kind regards,
Danielle

fago’s picture

Version: 6.x-1.0 » 6.x-1.x-dev

Does it depend on the token you are using or does it fail with any token? Does token replacing work elsewhere, e.g. when outputting a single message? Please also test whether the bug is in the latest version too.

capellic’s picture

I'm having better luck with the DEV version that I downloaded this morning, but my real problem has nothing to do with a bug.

Per my previous comment:

Next, I added a token to the body of the arbitrary email from one of the Content Profile nodes I had previously loaded --- yeah -- a small detail I left out! ;-) Then I tested and I *didn't* get the email. Huh, the token is the problem. Oh yes, the email that is supposed to go to the role is full of tokens, so we may be on to something here.

The token is not the problem. The problem is that my rule is fired off when a user is created. The problem is that when my Content Profile nodes have not yet been created so the rule is bombing out. It's on that the tokens aren't merged, it's that the rule is failing to run to completion. If it was simply a token problem, I would receive the email without the tokens merged. It would be nice if the module wrote an error to the log so that we could see that the node that was to be loaded couldn't be loaded. If the rule bombs out after that, fine.

So it would seem that I don't have an Event defined in Rules that will allow me to load content from Content Profile nodes at the time the user is registering and creating the user. What about triggering the email after the last Content Profile node is created (I am creating three during registration)? That works if you only need tokens from the last node, but I haven't been able to load another Content Profile node in that rule. I'm assuming that this is because the acting user is anonymous and doesn't have a user ID, so trying to load a Content Profile node as the Acting User or the Content's Author doesn't work.

One solution may be to do a page redirect with the uid appended to the end and then do node loads using that arg? Seems hackish.

We may be getting out of scope here as far as this issue goes. Let me know and I'll gladly submit a the appropriate issues to the queue.

Summit’s picture

Subscribing, greetings, Martijn

juicytoo’s picture

I have the same problem.

running on vista using a tool called "antix smtp server for developers".

I pipes the email to a file.

In the email [To] field I get [none] as the recipient.

It's suppose to use the userObj [user].

Don't know why.

In the configuration screen for rules

ie.

http://localhost:85/admin/rules/rules/rules_3/edit/3?destination=admin/r...

There is no option to set the receiver, so supposedly it gets it from the [user] object.

it is not working for me.

Maybe all these issues are windows related?

do not know why?

Ed

dankohn’s picture

Title: Email not received » "Send a mail to an arbitrary mail address" doesn't send mail
Version: 6.x-1.x-dev » 6.x-1.1
Priority: Normal » Critical
Status: Postponed (maintainer needs more info) » Active

[I changed this bug report after further investigation.]

Send email to an arbitrary address is not working when I put my system email address as the recipient. This is true whether or not I fill in the system address to the sender or leave it blank. It does work when I put a different email address as the recipient.

Here's the message I get when I save the new content, with debug messages on:

Created new alias comment/test-8 for node/48490
0 ms "After saving new content" has been invoked.
0.151 ms Executing the rule "email specific address" on rule set "After saving new content"
0.418 ms Condition "Created content is Comments" evaluated to TRUE.
0.591 ms Action execution: "Send a mail to an arbitrary mail address"
87.704 ms Executing the rule "email specific (non-system) address" on rule set "After saving new content"
88.071 ms Condition "Created content is Comments" evaluated to TRUE.
89.055 ms Action execution: "Send a mail to an arbitrary mail address"
142.349 ms Evaluation of "After saving new content" has been finished.
Comments test 8 has been created.

But I only get one email, the non-system one. Also, the issue could have something to do with domains. I get the mail when it goes to dan@dankohn.com but not when it is set to either support@healingthresholds.com or ads@healingthresholds.com.

Here are the rules, not that there's anything at all special about them:

array (
  'rules' => 
  array (
    'rules_4' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_insert',
      '#label' => 'email specific address',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Created content is Comments',
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#name' => 'rules_condition_content_is_type',
          '#settings' => 
          array (
            'type' => 
            array (
              'content_comments' => 'content_comments',
            ),
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#type' => 'condition',
        ),
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#type' => 'action',
          '#settings' => 
          array (
            'to' => 'support@healingthresholds.com',
            'from' => 'support@healingthresholds.com',
            'subject' => 'Send a mail to an arbitrary mail address',
            'message' => 'Send a mail to an arbitrary mail address',
          ),
          '#name' => 'rules_action_mail',
          '#info' => 
          array (
            'label' => 'Send a mail to an arbitrary mail address',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'subject',
              1 => 'message',
              2 => 'from',
              3 => 'to',
            ),
          ),
        ),
      ),
      '#version' => 6003,
    ),
    'rules_5' => 
    array (
      '#type' => 'rule',
      '#set' => 'event_node_insert',
      '#label' => 'email specific (non-system) address',
      '#active' => 1,
      '#weight' => '0',
      '#categories' => 
      array (
      ),
      '#status' => 'custom',
      '#conditions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#info' => 
          array (
            'label' => 'Created content is Comments',
            'arguments' => 
            array (
              'node' => 
              array (
                'type' => 'node',
                'label' => 'Content',
              ),
            ),
            'module' => 'Node',
          ),
          '#name' => 'rules_condition_content_is_type',
          '#settings' => 
          array (
            'type' => 
            array (
              'content_comments' => 'content_comments',
            ),
            '#argument map' => 
            array (
              'node' => 'node',
            ),
          ),
          '#type' => 'condition',
        ),
      ),
      '#actions' => 
      array (
        0 => 
        array (
          '#weight' => 0,
          '#type' => 'action',
          '#settings' => 
          array (
            'to' => 'dan@dankohn.com',
            'from' => 'support@healingthresholds.com',
            'subject' => 'Send a mail to an arbitrary mail address (non-system)',
            'message' => 'Send a mail to an arbitrary mail address (non-system)',
          ),
          '#name' => 'rules_action_mail',
          '#info' => 
          array (
            'label' => 'Send a mail to an arbitrary mail address',
            'module' => 'System',
            'eval input' => 
            array (
              0 => 'subject',
              1 => 'message',
              2 => 'from',
              3 => 'to',
            ),
          ),
        ),
      ),
      '#version' => 6003,
    ),
  ),
)

Also, I'm happy to give you an admin account on this staging server if it helps you run down the problem.

My planned workaround, until there's a fix, is to create a new alias at a different domain, which then bounces the mail to where I want it to go.

Thanks for what looks to be a great module, once the bugs are taken care of.

rburgundy’s picture

subscribing

DigitalFrontiersMedia’s picture

subscribing

fago’s picture

hm, I just tried it again: I'm unable to reproduce that. I plan to do a maintenance release soon and I'd really love to have this issue sorted out then, so please help and report the configuration that doesn't work for you.

Please report:
1) The action that doesn't work: ( Send mail to a user | Send mail to an arbitrary mail address)
2) The basic action configuration: (The user variable that is used / The mail TO address text + for both the FROM address text) - of course feel free to mask the real addresses.
3) Does it still not work when there isn't any token or PHP evaluation in use? (Yes / No )
3)a: If it doesn't work with token/PHP evaluation only, which tokens or PHP did you use?
4) Does the log say the mail has been sent successfully? (Yes / No )
5) Does the rules debug log say the action has been properly executed? (Yes / No)
6) Does sending mails with drupal work else when you try to send to the same address? (Yes / No )
7) Which rules version are you running (recent dev version / 1.1 / 1.0)

Dinis’s picture

Just re-tested, still having the same issue:

1) Send mail to all users in a role & send mail to arbitary mail address both tested, failing.
2) Condition is "When content is about to be saved".
3) Works perfiectly until I add a token into the mail, at which point all the mail sending actions fail. Removing the token does *NOT* fix the issue, and all mail related actions need to be deleted before it will work again.
4) No
5) Yes
6) Yes (I have also tested this on a server where emails are disabled. On that server, events which trigger an email will display a system error message, however no error is displayed when I test sending a mail triggered by Rules).
7) Most recent dev version.

Many thanks for looking into this.

fago’s picture

Status: Active » Postponed (maintainer needs more info)

ok, it looks it has something to do with the token... Still I can't imagine what's happening so please do more investigation:

* Does it fail depending on the token you use? E.g. try tokens using different variables (node:/author:). Also try to use a simple global token like "something:user-id".
* Does it fail when you use the PHP input filter too?

Dinis’s picture

Hi Fago,

Managed to get around to do more testing and it does not seem to be related to any particular token. I set up a system which worked many times (10 tests) using field tokens, I then added another field token and immediately all mail events began to fail.

I also tested adding additional events and it would appear that the rule stops processing at the point it hits the send email, as no further events will be processed in a given rule after a mail event while events prior to the mail event continue to trigger.

*edit* - on the same system I then tried removing the tokens module, leaving everything else intact; even with tokens uninstalled, the rules module does not start working again. What ever happens to those rules with token mail, it stays broken even without Token installed.

The debug output looks fine, all green with the rule returning a positive and indicating it will trigger.

Dani

shyam541’s picture

Hi Fago,

I am experiencing the same problem as Dinis. Thanks for looking into it.

Shyam Ramineni

mhindman’s picture

Don't have anything terribly helpful to add; just wanted to say I'm experiencing the same problem.

I have two completely different sites set up—one site actually works just fine. The other, however, will not send e-mails despite the log reporting that they were successfully sent. I have them both set to send an e-mail to an arbitrary address whenever any content on the site's created, though I also tested the other e-mail actions on the site that isn't working, with the same results.

Thanks for working on this!

KerriO’s picture

I go this to work by what was suggested in #9 (setting the weight to -2). This is especially odd since I only have one active rule and action. In case it helps, here's my setup:

1) The action that doesn't work: Send a mail to an arbitrary email address
2) The basic action configuration:
Event: "After saving new content"
Filters: "Content Type is…" and "User (creator) has roles 'anonymous'"
Recipient: recipient@gmail.com
Sender: noreply@site'surl.com
3) Does it still not work when there isn't any token or PHP evaluation in use? No. My configuration is very basic and no tokens or PHP evaluations are used.
3)a: If it doesn't work with token/PHP evaluation only, which tokens or PHP did you use? n/a
4) Does the log say the mail has been sent successfully? Yes
5) Does the rules debug log say the action has been properly executed? Sorry, this was not enabled
6) Does sending mails with drupal work else when you try to send to the same address? Yes
7) Which rules version are you running 6.x.1.2

shyam541’s picture

Hi,

I think there is some problem with Rules module sending email to Google Apps Account email. I changed the to email to my ususal gmail address and its working fine. But when I send email to admin@mydomain.com where google apps for the domain is configured, email is not going.

Shyam

AlexisWilke’s picture

Shyam,

That could be a PTR problem then. Your PTR needs to be set to your domain name on the server you're sending from. Otherwise, you need a "mail proxy" (really called "relay mail server").

If you don't have that, then that's probably normal that your emails bounce. My company's server is setup that way.

Thank you.
Alexis Wilke

shyam541’s picture

Alex,

Thanks. My webhost is ANHosting and I am on shared hosting plan. I will follow up with them. Will post update soon.

Thanks
Shyam

Aaron Stanush’s picture

Following. I also get a "Successfully sent email to
" message in the log, but not the actual email.

perarnet’s picture

I have the same problem. I have an trigger on a flag from the flag module. Sometimes the mail gets sent and sometimes not. Mail works fine on the site otherwise. Debug log says it's sent. but watchdog shows it doesn't.

henrykuo’s picture

Same problem as #32.

Sending email to arbitrary email address works fine if I just send a message with the word "test".

When I add a token, the email fails to send.

If I revert message back to just "test", the mail still fails to send.

I have another rule in place that works fine that sends mail using variables, no tokens, so it is definitely something to do wtih tokens.

I've tried a variety of weights for both the triggered rule as well as each of the rule's actions with no change in result.

I've deactivated the rule and hoping someone will find and post an answer here at some point. Not terribly upset as this would be a nice-to-have, but actually, it really would be a VERY nice-to-have.

Running the latest as of this posting: Rules 6.x-1.3, Token 6.x-1.15, Content Construction Kit (CCK) 6.x-2.8

henrykuo’s picture

Replying to my own post to update that my issue was unrelated to tokens, as the node I was trying to reference from actually did not include a reference to that node. My bad!

I was actually able to go another route to be able to reference the node in a sort of roundabout way using the "Rules and Views Integration" module. http://drupal.org/project/rules_views

It allowed me extract the email address I needed using the power of Views which I was then allowed to use as a variable within Rules. A really powerful module which opens up an incredible number of possibilities. For anyone that still can't resolve any token issues within rules, you might want to give this a try as an alternate solution.

TheMathMan’s picture

Priority: Critical » Minor

Cannot speak for everyone's issues, but found out that my issue with Rules not sending emails and logging that it was, was tied to the 'Sender Field' in the 'Send a mail to an arbitrary mail address' settings.

When I input a sender no emails were sent, when I left this field blank emails went through just fine. Decided to try this after reading another post about the Webform module not sending emails, and the solution recommended was to leave the 'From' field blank. More on that if you want http://drupal.org/node/364673

bxfresh220’s picture

subscribing

TrevorBradley’s picture

Darn it, I came upon this thread having the same problems.

I just tried the "fix" in 43, removing my sender field, but no mail was sent.

I'm using rules to run an arbitrary PHP code when a sheetnode has been changed (I'm creating an email to say which cells have been changed since the last revision).

I'm going to try installing this on my skunkworks site and see if I can get the mail to work at all.

EDIT: Looks like I was wrong and that this site *isn't* sending out mail correctly. There's a nice test script here I'll talk with my site admin to get that working, and report back here.

EDIT2: Yup, it was a sendmail/php config issue for me.

mjstone323’s picture

I seem to be having a similar problem: http://drupal.org/node/1118580

What's strange is that I use tokens in another email sent via Rules, and it sends the email just fine. So maybe it's something to do with sending the email via a ruleset? I don't use a ruleset for my other triggered email action.

Dinis’s picture

Just adding another 2c (seeing as it's been 12 months since my last post on this topic).

When running the dev build from back when this was reported on a 'nix box instead of Windows, I am completely unable to replicate the issue, however building it on Windows again and the issue returns almost immediately.

Just throwing it out there, but I wonder if all those of us who experienced issues were/are on Windows based servers (no idea why this should matter mind).

Danielle

klausi’s picture

Version: 6.x-1.1 » 7.x-2.x-dev
Component: Miscellaneous » Rules Engine
Priority: Minor » Critical
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closed since no further information has been provided. Reopen if still an issue.

aendra’s picture

Version: 7.x-2.x-dev » 6.x-1.4
Status: Closed (cannot reproduce) » Active

I'm having this issue on Windows Server 2008 R2.

If I remove all tokens from everything -- I set email to a static address, I don't put any tokens in the body -- emails send (I'm using Maillog to detect mailings). If, however, I put a token in either the recipient or body, emails don't send and nothing is logged anywhere.

I'm using Rules 6.x-1.4, Token 6.x-1.16.

It seems this issue has been occurring in both the 6x and 7x branches, ergo all the Version changing throughout?

fago’s picture

Version: 6.x-1.4 » 7.x-2.x-dev
Status: Active » Closed (cannot reproduce)

The same issue certainly won't apply to 6.x as we don't have a code registry there. Thus, if there are 6.x problems this is something else. Consequently, please look for an existing 6.x issue in regard to that and/or create a new one.

AlexisWilke’s picture

fago, just saying... the person who switch this to 7.x actually hijacked the 6.x issue and the users who are still using 6.x won't know what the new issue will be. So it seems to me that this should stay open even if the fix for 6.x is different (the person who changed this to 7.x made a mistake... not the other way around.) Alexis

vstmusic’s picture

Same problem and the solution (for me....) :

Change the browser !!!

SAFARI broke all sends by rules.
CHROME not !!!!!

(5 hours of testings for that...)

Is it a known issue ?

rbenhase’s picture

I've been having this same issue and may have narrowed down/isolated the issue.

My rule event was initially set to "after saving new content." After my trouble, however, I changed the event to "before saving content" and added "Entity is new". This worked; whenever a user saved a node, it would send an email to the administrator. This worked with an arbitrary email address as well as the [site:mail] replacement.

So, perhaps this is a workaround for some of the folks having trouble here; as far as I can tell, it achieves the same effect as sending an email after publishing a node.

Furthermore, this raises the question as to whether the aforementioned bug is related specifically to the "after saving new content" event. Can anyone else confirm that they were using this event when they ran into trouble?

Perhaps when Drupal automatically and immediately redirects a user to the newly-published node upon save, the Rule gets lost in the mix (see fago's comment, #10 above)?

Just a thought.

Running Rules 7.x-2.0-rc2.

klokie’s picture

I'm having the same issue with the "send mail" action (in Rules 7.x-2.0). I've tried the recommendations in this thread, including #43, #53, and even #52, but the email is simply not sent even though the log reports otherwise. However, the "Send mail to all users of a role" rule works fine to send email, as do the site-wide contact forms.

amysansom’s picture

I also have something similar with 7x-2.0 - when the content has been created by a registered user it'll send an email to an address inserted into a field, however, when the content has been created by 'anonymous' it doesn't send. The "send mail to all users of a role" works fine.

Shoffner’s picture

FWIW, I had this problem with Drupal 6 site, and finally, after several hours, realized that is was being caused by Theme Developer module. When I turned that off, it worked.

llepere’s picture

Yet another permutation. Using 7x-2.1 I was having a similar issue with mail not arriving for both "arbitrary address" and "users of a role" even though the log said it was sent. In my case I determined that if my subject field contains a colon the mail will not be received. So mail with subject "New calendar event: [node:title]" does not arrive but mail with subject "New calendar event - [node:title]" does arrive.

pha3z’s picture

Same problem. Weight -2 didn't fix it. And changing from After Save to Before Save didn't fix it either.

There is no reason to use this buggy module if its going to be even remotely unreliable. Better off just writing a node save hook with your own email code. You'll be able to count on your own code executing fast and working every time.

miteshsharma02’s picture

Category: bug » task

It doesnot work when sending mails to other mail server, when sent to the same host it works.

lightsurge’s picture

Version: 7.x-2.x-dev » 6.x-1.x-dev

There seem to be enough reasons this sort of problem can happen in 6.x, it's confusing to add 7.x to the mix. Can't the 7.x issues with arbitrary email sending be split out into a separate issue?

Anyway, I did some trouble-shooting in 6.x. For me, the problem turned out to be cck node reference integration when tokens were in use. It was possible to configure rules to load a node from a reference in a created node into $reference1 and then load a node reference in $reference1 into $reference2 (which had the email address field I wanted to use), but that configuration broke the rule.

The result was that I didn't get a 'successful email sent' log message or a failure, and no attempt by drupal to send an email, no error messages in logs. Programatically getting the email field I wanted in a PHP action, and removing the attempt to load the second reference, meant email sending worked fine.

mitchell’s picture

Title: "Send a mail to an arbitrary mail address" doesn't send mail » How to: diagnose problems sending email
Component: Rules Engine » Documentation
Priority: Critical » Major
Status: Closed (cannot reproduce) » Active

This issue is becoming unwieldy. It seems like a bunch of cases where people had problems then figured them out somewhere outside of Rules, which makes sense, since this is just a basic core wrapper action that has always worked fine, given a well configured setup. AFAICT, the problem is that we need to take these experiences and other related pages on d.o and work them into a reusable documentation page. This is my recommendation, but I'd appreciate if someone else could take it on. If anyone has a better suggestion on what to do here, then by all means compile the info and make it happen. I just hate to see issues drag on with nothing useful coming from it.

#57: Please submit a bug report with exports and debug logs or such.

lightsurge’s picture

It seems like a bunch of cases where people had problems then figured them out somewhere outside of Rules, which makes sense

Actually I think that covers about 50%. Those for whom the logs show successful emails sent, but no emails going out, seem to have a problem outside of Rules.

The other half who have no such message in their logs, seem to have a problem within Rules?

For instance, my problem in #60 was that it was possible to configure a rule, such that on saving of a new node, it loads a node referenced by it, and then to further load a node referenced by that node, and then finally send an email to an email address contained in that final node object. The event was triggered, but the action was not completed - the rule apparently breaks halfway through. It's nothing to do with that node not existing yet, or the reference to it not existing yet, because I could load it fine in a PHP action.

I suppose it's part of the architecture of Rules that no errors are logged for failures that occur during processing of these actions.

bokz’s picture

I tried changing the weight to -2 and it worked, I still don't know why

babruix’s picture

Issue summary: View changes

I had same issue on different sites, after investigation I have found that Drupal mail system was changed to TestingMailSystem.
Changing to default fixed the issue. Here is code (D7) to check what current mail system is and change it to default.

  $mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
  dpm($mail_system);
// Uncomment and change next line to remove unwanted mail system in array.
// unset($mail_system['maillog']);
  $mail_system['default-system'] = 'DefaultMailSystem';
  variable_set('mail_system', $mail_system);
andreavr’s picture

Are you able to explain more about how to use this code? Where we should run it?

Cheers

TR’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
TR’s picture

Status: Active » Closed (outdated)

After re-reading the entire thread, I realize I shouldn't have moved this to 7.x-2.x. This thread is all about 6.x-1.x. And like @mitchell said in #61 (6 years ago!) "This thread is getting unwieldy".

Because 6.x-1.x is obsolete and unsupported, there's nothing to be gained by leaving this open.

Be aware that because Rules simply provides a wrapper around the core Drupal mail function, it's highly likely that your problem isn't because of Rules. Please search this issue queue, including CLOSED issues, for help first. If you continue to have problems sending email from Rules in 7.x-2.x or 8.x-3.x, then please open a NEW issue with details about how to reproduce your problem, including an export of your Rule.

dmduke made their first commit to this issue’s fork.