I have a menu hook and page callback which takes several arguments to generate some table data in a page, the page makes heavy use of entityfield_query and some other modules.

I need to be able to e-mail the contents of this page based on a set of periodic dates. What's the best way to achieve this?

I realise that the css will all have to be added to the page but if I could get the structure into an e-mail that would be a start.


You can use drupal_mail() together with hook_mail() to send email.

See also the Examples for Developers.

| improve this answer | |
  • This works for sending email but it does not answer how I can do this periodically, I need to do it based on a financial calendar which I have stored elsewhere. – Daniel Harper Aug 20 '13 at 10:12
  • @DanielHarper if you need to run periodic tasks, use hook_cron – David Thomas Aug 20 '13 at 23:46
  • But cron runs every hr and I don't want the e-mail to send every hr just once on a specific set of days. – Daniel Harper Aug 21 '13 at 9:11
  • Check the day in hook_cron and send if needed. – David Thomas Aug 21 '13 at 11:33
  • So then it would run every hour of that day, I guess I would check whether it is a specific hour as well – Daniel Harper Aug 21 '13 at 13:09

Check out this link with full detailed explanation on how to send and edit the contents.

How to programmatically send an email?

| improve this answer | |
  • While this could answer the question, it is better to expand the answer with a summary of what reported in the linked page. Stack Exchange sites don't aim to be a repository of links, but a repository of knowledge. – kiamlaluno Aug 14 '13 at 16: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.