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?

1 Answer 1

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;
}
2
  • but how to get all node title and put it in the email body?
    – Dieyy
    Commented Jul 20, 2013 at 19:17
  • I have updated my post, Call get_node_titles() function, it will returns all node titles in array format.
    – Ayaz
    Commented Jul 23, 2013 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.