This article explains how the Mass Messaging module works.

The general concept is to use Views to select recipients and create individual messages for each recipient. This module provides an API as well as a Rule action to send messages.
The implementation guarantees that each messages is sent exactly once.

Setup the view

You can use any view for this. It is important to use the Mass Messaging Display. There you need to set up the field matching between the message fields (subject, recipients, message body etc.) and the views field.
The identifier field is very important. There you need to select an integer field, which identifies the message. In most cases the user ID is the best one, because you do not like to send multiple messages per view invocation.
You can also use views arguments. There you can pass information from the rule action.
Also an interesting module for the views implementation is the Views Cross Join. With this you can join in entities, which do not have any relation with the existing content.

Use Cases

A simple use case is a subscription mechanism for a specific topic. You have a taxonomy called topic. Users can subscribe for certain topics (Terms). When new content is added to one of this topic the user receives a mail message with the new content. This use cases can be implemented by this module in the following way:

  1. Before you start you will need the latest versions of Views, MimeMail, and Rules
  2. Create a new taxonomy called "Topics"
  3. Add a Term Reference field to the user. (Configuration > Account Settings > Manage Fields) Use the "Topics" taxonomy. Call the field for example "subscribe to topics".
  4. Add a Term Reference field to the content type you want to make subscribable. Use the "Topics" taxonomy and call this field for example "subscribe as".
  5. Now the tricky part: Add a view. Use as the base entity "User".
  6. Add a Display of type 'Message List'
  7. Add fields: User:Name, User:Email, User:ID, User:Subscribe to Topics
  8. Add a new relationship. Use the "subscribe to topic" field. Set the relation as required.
  9. Add field: Taxonomy Term ID
  10. Add relation to join in the nodes which has the same topic as the user has subscribe to - in our case: "Taxonomy Term: Content using 'subscribe as'"
  11. Add an contextual filter: Taxonomy Term ID. Set the condition for 'when the filter value is not available' to 'Hide View'.
  12. Add a second contextual filter: Content Nid. Set the condition for 'when the filter value is not available' to 'Hide View'.
  13. In the Mass Messaging Settings' select the appropriate fields for the subject (e.g. the node title), recipient (User Mail Address), Text Body (e.g. content body) and Message Identifier Field (must be User ID). Set Message Send Method to 'Mail'.
  14. Delete the 'Page' display - it is not required and could have security issues
  15. Save the view
  16. Create new rule. Use the event "After new content has been saved". Add a condition on which you check if the Term Reference field is defined (for example 'content is of type.').
  17. Add the action: 'Fetch Entity by ID'. Select entity type as Taxonomy Term. Select Identifier as (in our example) node:field_subscribed_as:tid. Provide names for the fetched identity variable label (for example 'Fetched Entity') and for the fetched identity variable name (for example 'entity_fetched')
  18. Add the "Send Mass Message" action. There you need to select the previous created View. As arguments you need to define on the first line the term ([enity_fetched:nid])and on the second line the node id ([node:nid]).
  19. Save the rule.
  20. Test it!