Extension:SemanticMailMerge

The SemanticMailMerge extension integrates with to merge each result of a semantic query into a template and email the resultant HTML to recipients specified in the query.

Usage
Akin to the standard 'template' result format, this extension requires two pages: one with the  query, and one template (specified in the query). The output of the query is the same as the 'table' result format, and the data from each row is put into the template and emailed to all email addresses specified in the 'To' column. You have to use  as the result format option within the semantic query.

To preview the output, change  to   (although they may run into each other, depending on the formatting in the template).

The actual email-sending is done separately, so that it can be scheduled (by an external task-system such as crontab or Scheduled Tasks). On the required schedule, the  file should be called:

Example
To send an annual review reminder to all document authors the following three pages could be used:

 Joe's Document Author::Joe Bloggs, Author email address::joe@example.org.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris.

Although individual data pages would be likely to use a template. Template:Document reminder Dear ,

You are an author of [ ], a document which is up for annual review.

It was last edited on. This could, of course, pull its content from elsewhere in all the usual ways. Note also the use of canonicalurl, because this will be used in a non-wiki context (i.e. a mail client). Document reminder

 

The reminders would then be sent by calling the following as often as required:

Outstanding problems

 * Page moves. If a query page is moved, the data referring to its old location is not purged.
 * Custom recipients' column. Currently hard-coded as 'To'. Perhaps not customizable, but should at least be localized.
 * Links in the HTML for the email need to be expanded to be canonical URLs.
 * Permit more than one query on a page (does an query have an identifier?). Currently uses the page title to identify it.
 * Support.