How hard would it be for me to automagically email a document(s) to a MODx group of users based on role? Can you point me to relevant snippets and/or features? Email doesn’t have to be formatted as HTML; text would be fine.
I’m pretty sure that with
Newsletter snippet you can send modx documents via email to selected users/usergroups.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Yes, I’m confident about that but can I pass documents already created automatically to the Newsletter snippet according to some condition (take the top document from this folder and mail it every morning at 7 AM to ’this’ group). Or, do I need to explicitly assign documents to the Newsletter snippet and manually execute a ’send’?
For instance, suppose I wanted to create a digest of content each day. I assume I could create a document that auto-aggregated content from the previous day’s documents but can that document be passed to Newsletter (or some other snippet) without admin intervention?
You would have to modify the newsletter snippet to get it send messages automatically.. Another option would be to do a snippet what uses Ditto to build the mail content and send to set users based on usergroups. Then make a plugin that is attatched to some parsing event that runs on every page request, then in that plugin make the scheduling to run your snippet. You can get the code to all this by looking at the newsletter code (exept the plugin).
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Good catch and I should have mentioned it - otherwise, I might just as well cut-paste a document into manager mail and have an admin mail it to a group themselves.
Quote from: silent at Aug 12, 2006, 02:21 PM
So, you mean: without a user? Then we have a cron-issue here, I suppose.
Yes, cron job would be the best, but if the site has frequent users, plugin attached to parse event can do the scheduling too.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
The TimedPublisher snippet I’m working on is an example of showing or hiding content based on the getdate() function and could be easily modified to send your mails at a certain time of day.
The file is in the Snippet development area, have a look and see if it can help...
http://modxcms.com/forums/index.php/topic,6250.0.html
That code does look interesting, but I don’t see how to modify it to actually send the emails themselves?