0

I am about to send an email to website admin.

First of all, there will be a function to get list of node's title that city field equal to 'barcelona'.

After that, the list will be send to website admin once every day using e-mail.

Any idea on how to do this with Rules or custom module?

0

You need to create custom module and implement hook_cron().

See:

https://drupal.org/developing/modules

Also check this post: How to create a task which run at cron time and send emails to users?

function get_node_titles() {
    $result = db_query('SELECT n.title FROM {node} n');

    $titles = array();
    foreach($result as $item) {
        $titles[]  = $item->title;
    }

    return $titles;
}
  • but how to get all node title and put it in the email body? – Dieyy Jul 20 '13 at 19:17
  • I have updated my post, Call get_node_titles() function, it will returns all node titles in array format. – Ayaz Jul 23 '13 at 18:30

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.