I’m working on a custom newsletter subscription addon for my church’s website. It consists of a module for sending the newsletter to everybody on the mailing list, and a snippet that the subscription page of the website uses for subscribing users.
In the process of subscribing a new user, I need to send a few emails for confirmation, etc, so I’m using the excellent Swift Mailer library (
http://swiftmailer.org/).
To make it easy for the church staff to edit the text of these emails, I’m creating a document (unpublished) for each one, all organized into a subscriptions folder in the site tree.
My question is, how can I get the parsed content of one of these documents in my snippet code so that I can pass it along to Swift Mailer to send the email? I will be setting some placeholders, so that’s the main reason I need to parse the content. Each email has the HTML message in the content field, but I also have a template variable that contains the plaintext version of the message, so it’d be great if I could get that parsed as well.
If that’s not doable, then I could probably write my own code to replace the placeholders with the correct data, but it just makes more sense to use the built-in functionality of MODx to do so.
Thanks!