I've a request to set up an email form where by a OG administrator can send a message (via email) to all persons subscribed to that group.
closed as too broad by kiamlaluno♦ Nov 10 '15 at 6:52
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Using the Forena module, you could start from one of the Sample reports and solutions that come with it. I.e. the Active Users Email, which is a demo of the ability to send email to all active users of a Drupal site.
The idea is that those users who have access to it, actually get a FORM to have Drupal send an eMail to all users selected via the query. To do so, you just have to "submit the report".
The easiest way to see the out-of-the-box example at work, is to (temporary) install the module in some dev environment you have available (for obvious reasons this sample report is NOT available to anonymous users in a Forena demo site ...).
Here is what would be needed to transform (clone) this sample to fit your needs:
- Adapt its data block (an SQL query) to list "all persons subscribed to an organic group" (instead of all "active users of a Drupal site").
- Adapt the actual content of the delivered eMail template to fit the actual eMail content (message).
- Optionally you may want to make the "Organic group" to be selected a report parameter.
- Secure "access" so that only the OG administrator can send such eMails. Depending on how your OG group(s) security is setup, you may want to adapt the Forena permissions accordingly.
Note: the above approach can be used for all sorts of eMails towards any set of users of a Drupal site. Whereas that "set of users" is just a matter of writing some (basic) SQL statement to select the users you want to target. E.g: (a) users with a selected role or (b) users who didn't login for X days anymore or ... And the actual eMail content (message to be delivered) is actually anything you can format as an XHTML document.
Disclosure: I'm a co-maintainer of the Forena module.
This question have been answer at - How to loop over a list of Organic Group users using Rules
and at - How to send an email to Drupal 7 Organic Groups Role Members? in here is going to show you how to do it with a custom module.
There other alternatives:
1- You can use views_bulk_operations
I would think you should be able to do it by adding views_bulk_operations to the mix-- that should give you the ability to email users in a view which you can setup with the criteria you need via filtering.
2- You can do it with Rules
Looping over a list can only be done in Rules (i.e. for Drupal 7).
I would have thought that Rules would be your best option
I think that module og_mailinglist will help you with the most functionality you need But still you have to do some customization.
First: It lets any member to send mail to all group users, And in your case you need only the group admin so I see you need to create a custom menu item with access checking for group admins only which navigates the admin to where he will send the module.
Second: reply to the email will create content which is not needed and considered a security risk you have to take care and prevent that functionality
Finally: Read the module documentation carefully and check its API well to achieve you goal with the optimal way.
Also message_notify deserves to give it a try But I think it may need extra configuration and customization.
If you aren't willing to use those OG specific modules, I'd suggest using an entity form with entity reference prepopulate to make it cleaner.
- Create an entity form with the required fields such as email title and body.
- Add an entity reference field with prepopulate (and hide) enabled.
- Construct a url that fills the entity reference field with the group nid using tokens.
Using rules on entity form save, you can then loop through the subscribed members to the group referenced in the entity form and construct your email using the entity form fields.
Some benefits to using the above as a base method..
- You can load the entity form inside a colorbox to give a very nice UI.
- You can add extra fields as needed.
- You can get a bit fancier and make the email get sent to users from certain roles etc.