I have to write a rule for the event 'After sending email'. How can I do that?

For example there are three users user1, user2, user3. I need to enable a flag on a content type after admin sending email to those three users.

  • Not a trivial task - you'll probably need to write your own mailsystem which extends the default one to invoke a custom action whenever mail is sent. You can use hook_action_info() to define the action, but I doubt anyone will write the whole thing for you so probably best you have a go yourself, and come back with specific problems :)
    – Clive
    Sep 17, 2013 at 14:06
  • My bad, you can implement hook_mail_alter() and fire a custom action from there. Quite a small job
    – Clive
    Sep 17, 2013 at 14:07

1 Answer 1


There is no Rules Event like "*after sending eMail". However, you can create a Rules Component for sending an eMail. For a sample of such Rules Component, refer to the answer to "Rule to store user's last post date and scheduled rule based 30 day reminder".

If you then "invoke this Rules component" any time a rule has to send an eMail, you basically created the equivalent of the Rules Event you're asking for. All that's left to do is to expand that Rules Component with additional Rules logic that you want to happen "after sending eMail" (... as in your question).

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.