我如何在drupal中创建一个每月通过电子邮件发送的报告?

I have a view set up that I want to be emailed to me(or whomever inherits my position down the road) similar to how the update report gets emailed.

This view is all set up and pulls the data I need. I also have external cron which can runs any link I tell it to(like the external cron link), so I can have the monthly run done if given a link to put in. The part that I can't figure out what to do is how to set this up to be emailed or how to get a link to run it via the external cron job/set it to run via the internal cron on the first of the month

You can have more solutions here, in the end is up to you which fits you better:

  1. In a custom module I would implement the hook_cron(). In this hook I would execute the view I want (this is not hard, let me know if you need help here), and then just e-mail the entire output (I guess this is what you want). Now, you want that this e-mail to be sent only once per month.For this you can have two possibilities:

    • handle this in you cron hook: basically you store the last time when you sent the mail in a variable (using variable_set / variable_get) and if you sent it last month, then it means you have to send it again, so you update first the variable, call the view, prepare the output and send it by mail.
    • there is a module called elysia_cron: https://www.drupal.org/project/elysia_cron which you can configure so that each cron hook on your site runs only at specific times (just like you configure the crontab).
  2. Another solution is to have an endpoint on your site, instead of the hook_cron(), that would basically do the same as in the previous solution: call the view and send the mail. The difference is that you can configure your crontab to call this URL whenever you want, so no special configuration required. One more thing here: the access to this endpoint. In my opinion, this should be somehow restricted, but because you cannot impose a restriction based on a user role (your cron will just call the endpoint as anonymous user), you have to find another solution (either a token appended to the url, or maybe that the enpoint can be called from a specific ip, etc..). This is the main reason why I prefer the hook_cron() because this just fits better in Drupal.

I am a Drupal developer, so what I would in this particular case is number 1)