0

I would like to allow each user to manage its own mailing list (import a csv list, add/remove emails). My goal is to allow users to send an email notification to this list when they create a certain content type.

Modules like simplenews, Views_Send, or mailing_list don't seem to match my needs as they only allow to create "globals" newsletters associated with a subscription system, not real email list "crud" by user.

Maybe should I use a generic csv data importer, views/bulk and rules to achieve this?

0

Start with adding a multi-value field to store eMail addresses. Say with a machine name like field_email_addresses. Assume the content type you're using for this is "Article" (pick whatever fits).

With the above in place, uou could use the Rules module to achieve your goal. Similar to what is shown in my answer to "How to check with Rules if a new element has been added to a list in a node?". By using the rule included in that answer, you can discover scenarios such as these:

Value user3@example.com was removed from the multi value field.
Value user2@example.com was added to the multi value field.

Here is a simplified version of the rule that only shows the inserted values:

{ "rules_verify_updates_to_selected_email_ids" : {
    "LABEL" : "Verify updates to selected eMail IDs",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules_conditional", "rules" ],
    "ON" : { "node_update--article" : { "bundle" : "article" } },
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "node:field-email-addresses" ] },
          "ITEM" : { "current_email_id" : "Current eMail ID" },
          "DO" : [
            { "CONDITIONAL" : [
                {
                  "IF" : { "NOT list_contains" : {
                      "list" : [ "node-unchanged:field-email-addresses" ],
                      "item" : [ "current-email-id" ]
                    }
                  },
                  "DO" : [
                    { "drupal_message" : { "message" : "Value [current-email-id:value] was added to the multi value field." } }
                  ]
                }
              ]
            }
          ]
        }
      }
    ]
  }
}

If you just add a field with machine name "field_email_addresses" to your articles content type you should be able to import this rule in your own site and experiment with this rule in your own site to see it at work (for nodes of content type "Article", adapt this type to fit your needs).

All that's left to do is to transform the message that is displayed by sending an appropriate eMail (which is like a Rules-getting-started exercise). That will allow you to eMail relevant parts of the node whenever some eMail Id is added to that field already.

Some suggestions to further improve this solution:

  1. Send it to all (not just updated) eMail ids mentioned in the field_email_addresses field, by creating another rule that is triggered with Rules Event "After saving a new node of content type Article".
  2. Also use the Flag module so that if the node is flagged by the node author (and only then), send it to all eMail ids mentioned in the field_email_addresses field (something that is straight forward to do with another rule).
  3. Variation of the previous item (which does not require the Flag module): add an extra (boolean) field to Articles, to indicate something like "Send this node as an eMail now".
  4. Replace that field_email_addresses field (related to the Article content type) by a similar profile field with similar purpose. So that by combining it with the Views Rules module, you create a Rules loop to eMail all those users when such article is created, flagged, etc.

The above are just some basic solutions to implement what you're looking for. To further improve it (eg: combine it with importing a CSV list) should really be a different 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.