I'm trying to set up Drupal User Registration that requires Administrator approval. I set up the following rule:
Event: After Saving a New User Account
Condition: User Account is Blocked
Actions:
Send Mail
To: example@example.com
Subject: New User Registration for...
Message: A new user has requested...
From: No-replay@example.com
Send account e-mail
Parameter:Account:[account]
E-mail type: Welcome (awaiting approval)
Both emails show up in the logs but only the first is successfully sent. Here are the messages from the logs:
MESSAGE Successfully sent email to example@example.com
MESSAGE Welcome (awaiting approval) e-mail sent to example@gmail.com.
I tried replacing the 2nd email address with example@example.com to make sure it wasn't a gmail issue and the 2nd email still failed to send.
Comments
Comment #2
dcamburn CreditAttribution: dcamburn commentedComment #3
dcamburn CreditAttribution: dcamburn commentedAdditionally, looking at the rules module, I should be receiving an email without even having to have the first action in there. That email is also not being sent successfully:
if ($email_type == 'register_pending_approval') {
// If a user registered requiring admin approval, notify the admin, too.
// We use the site default language for this.
drupal_mail('user', 'register_pending_approval_admin', variable_get('site_mail', ini_get('sendmail_from')), language_default(), $params);
}
Comment #4
dcamburn CreditAttribution: dcamburn commentedComment #5
dcamburn CreditAttribution: dcamburn commentedThis issue apparently resolved itself 24 hours after posting this.
Comment #6
dcamburn CreditAttribution: dcamburn commentedThey stopped working again :/
Comment #7
TR CreditAttribution: TR commentedThe 'Send account e-mail' action differs from the 'Send mail' in several ways.
Specifically, I think what's probably happening on your site is that the "From" address is causing a problem. With 'Send mail', you get to specify the "From" address. But with 'Send account e-mail', the "From" address is taken from the site_mail variable. If that variable isn't set, then the e-mail will go out without a "From" address and will probably fail to be delivered because your mail server or the receiving mail server rejects it. The site_mail variable is used as the "From" address, and is ALSO uses as the "To" address for the mail sent to the administrator by this action. The site_mail variable is set through the Drupal UI at /admin/config/system/site-information. If you check that and find that you really do have a site_mail, then this could still be the problem because many servers don't allow you to send mail "From" a different domain than your server (or perhaps have whitelisted the domains they allow).
When you see a message in the dblog that indicates the mail was sent, that means Rules has called the core Drupal drupal_mail() function and has been informed by core Drupal that the sending was successful. At that point the mail is no longer handled by Rules, but by Drupal core.
Regardless, this is almost certainly a problem with your mail/site/php configuration, not with Rules. Also check to see if you have any mail-related modules enabled, as those may interfere with the mail sending process.
Comment #8
TR CreditAttribution: TR commentedComment #9
TR CreditAttribution: TR commentedNo further information provided.