Aren't you allowed to use service APIs in your infrastructure for any reason? I am pretty sure there must be Plain Text to HTML converters around offering API support.
I haven't build that myself cause there is no need. I have HTML templates for our own use (similar to what Johann shared above) cause doing it via API calls doesn't really make sense to us.