Would it be useful to have the recipient as a dynamic field, like the subject, instead of being $message->uid.

The reason being if I want to send out a message to a large number of users, I could then iterate through the recipients and just change the arguments each time.
If the message was a callback to a view passing in the recipients uid, the same message can be used for all recipients. Or am I thinking about it wrong amd it doesn't really matter if you have a different message for each recipient?

I could do the same thing by changing the $message->uid each time but that seems like too much of a hack.

I guess the alternative is just to make a different message for each recipient and then if I don't want the database cluttered up I can have the save on * options set to FALSE.
Or just let it save to the database and potentially use a lot of space.

I was thinking of using job scheduler or something similar (potentially even just cron) to send out mass notifications to users in batches.

Is that the kind of thing this module is aimed at, or something else?

I'm kind of thinking out loud a little sorry.

Comments

rooby’s picture

Component: Documentation » Code
amitaibu’s picture

Why not attach an entity-reference field to the message?

rooby’s picture

I guess the issue is that message_notify_send_mail() specifically uses $message->uid as the recipient, so without hacking message_notify that isn't possible.

But that idea helps me think properly in a message frame of mind.
I'm still trying to get myself thinking in a message way so I can use it properly and get the most out of it.

amitaibu’s picture

Status: Active » Fixed

I guess the issue is that message_notify_send_mail() specifically uses $message->uid as the recipient, so without hacking message_notify that isn't possible.

The Email plugin now allows overriding the email:

$plugin = array(
  'title' => t('Email'),
  'description' => t('Send Message via email.'),
  'class' => 'MessageNotifierEmail',
  'options' => array(
    // Override mail. Don't use the email that is assigned to the user.
    'mail' => FALSE,
  ),
);

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

blackice2999’s picture

Category: support » feature
Status: Closed (fixed) » Needs work

Hi Amitaibu,

thanks for your solution but i think it will be good that we add an option to the rule action to provide a seperate mail address.

patch will follow.
Thanks Dennis

dready2011’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.88 KB

As described by blackice2999 (#6), here is the patch.

amitaibu’s picture

Tiny thing:

+++ b/message_notify.rules.inc
@@ -64,7 +72,7 @@ function message_notify_rules_action_info() {
+function message_notify_rules_process(Message $message, $save_on_fail, $save_on_success, $rendered_subject_field, $rendered_body_field, $mail=false) {

false => FALSE

dready2011’s picture

StatusFileSize
new1.88 KB

Here the corrected patch

amitaibu’s picture

Status: Needs review » Fixed

Fixed $mail=FALSE to $mail = FALSE and committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.