I was annoyed by the inflexibility of action_send_email()

with this patch you can assign

  • Roles
  • Users
  • email-addresses (not just one)
  • and the author

to be the recipients

some small cavearts:

  • currently there is no update path for the old recipient
  • the autocomplete does only work for the first user (I thought that autocomplete works for the second username inputted too... but it looks like I am not right in this point)
  • maybe i should replace the "Individual email-adresses"-field with the textarea known of organic groups (for example: http://groups.drupal.org/og/invite/90)
  • i think the UI could look better... but i have no ideas for now.

please review! (screenshot attached)

Comments

Tobias Maier’s picture

Status: Active » Needs review
StatusFileSize
new10.28 KB

and here comes the patch

Tobias Maier’s picture

StatusFileSize
new10.52 KB

fixed some typos, spelling errors, etc.

Tobias Maier’s picture

StatusFileSize
new10.53 KB

I think it is not bad to check_plain() the messages' body and title
renamed some strings again.

Tobias Maier’s picture

StatusFileSize
new11.68 KB

this version is not very good tested
the upgrade path is completely untested...

* only active (non-blocked) users get a message
* small improvements
* upgrade path

Tobias Maier’s picture

StatusFileSize
new12.94 KB

fixed upgrade path (but untested again)
fixed some minor errors

I would be really happy if someone would comment on this... :/

If you would say that this is too much for an example action then I suggest du rename this function to action_send_emai_advanced() and "Send Email (Advanced)"
or to rename the old function to action_send_emai_simple() or action_send_emai_example() and "Send Email (Simple)" or "Send Email (Example)"

mfredrickson’s picture

Perhaps the best place for this action is:

http://drupal.org/node/48737

Christoph C. Cemper’s picture

thanks, but still a lot of variables missing in that patch...

e.g. I had to add

'%orig_url' => $base_url . '/node/' . $node->nid,
'%edit_url' => $base_url . '/node/' . $node->nid.'/edit',

after

'%node_url' => url('node/' . $node->nid, NULL, NULL, TRUE),

just to mail the non-aliased urls to the users...

ashtonium’s picture

Status: Needs review » Needs work

I would suggest fully testing your patch before submitting it, in order to cut down on submitting a series of buggy patches. Looks like it still needs some work, so I've changed the status. I've been looking into extending the email action as well so rather than create a separate issue, I'll just add onto yours.

I like the idea of creating this as action_send_email_advanced rather than modifying action_send_email, which may go along with mfredrickson's suggestion. Either way, it would be good to post this as a handbook page after the action is finished and fully tested.

moshe weitzman’s picture

I would also like to have available the prior and destination workflow states (with names), and the person who is making that transition. perhaps this could be done in a contrib module

drewish’s picture

the patch won't apply cleanly. looks like there's been some updates to the module.

dgtlmoon’s picture

wont apply here, heres the output, sounds like a great feature!

cat send_email_advanced.patch_3.txt|patch
patching file actions.inc
Hunk #1 FAILED at 359.
Hunk #2 FAILED at 378.
Hunk #3 FAILED at 460.
3 out of 3 hunks FAILED -- saving rejects to file actions.inc.rej
patching file actions.install
Hunk #2 succeeded at 32 with fuzz 2.
Hunk #3 succeeded at 40 with fuzz 2.
Hunk #4 FAILED at 54.
Hunk #5 FAILED at 80.
2 out of 5 hunks FAILED -- saving rejects to file actions.install.rej

seakayjay’s picture

I'm looking forward to this feature. subscribing...

drewish’s picture

Status: Needs work » Fixed

code for html mailing has gone into core and since actions is also in core i think it's safe to mark this as either won't fix (as a contrib module) or fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)