简体   繁体   中英

Send mail to address in another node in Drupal

I have a content type meeting that has a CCK node referer field that refers to one or more people nodes. Those people nodes contain a CCK Email field.

Now I'd like to send a mail to all people listed in the meeting node when the node is created. I don't know how to do that as the mail adresses are in different nodes, so I can't just send a tokenized mail, as those adresses are not available as tokens (as far as I can see).

Any idea on how to do that, preferably without writing a custom module.

Edit:

There seems to be no quick and easy way do to this, so I'll probably have to write some custom code to do that. I'm already using the Rules module, what would be the preferred way to programatically create a mail action? Do I have to create the mail stuff from scratch or can I modify some existing code?

It looks like you may be able to use a combination of the Rules , Views , and Rules and Views Integration modules to accomplish your goal.

  1. Create a view that returns the email address of People associated with a Meeting .
  2. Configure the view to "render" its results into a rule that sends emails to the resulting addresses.
  3. Create a rule that executes the view created in step 1 when a Meeting is created.

Please note that I haven't tried Rules and Views Integration myself, so it may not work as I expect. Additionally, I am uncertain if there is an email action for Rules that will take the output of your view as a parameter.

I'm not sure I understand. From reading your question, I would answer "Rules" can do that for you. But then in your edit you say that you use the rules module and you want to create a mail action?

I may be just tired, but please elaborate, and we'll see if we can work it out :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM