Kynetx module for Postmark
UPDATE: This module is now listed in the Kynetx module directory. Check it out here.
There was a question on Stack Overflow over the weekend about sending email through KRL. Sam's answer was that it's currently not possible in the runtime, but that you could create a module to work with a service like Postmark or SendGrid. I decided to take on the challenge.
The first draft of this module only lets you send with from, to, subject, and HTML body, but I'll extend it to support everything in the Postmark API.
Here's how to use it from your own app:
A few things to note:
- You need to provide keys to the module which contain your Postmark API key and the sender address. The sender is set globally here because that is more in line with the way the Postmark API works.
send_email()action will automatically raise and HTTP post event called "postmark_send". You can listen for this event and use the responses, as illustrated by the second rule in the ruleset.
- You need your own account with Postmark to use this. The free portion of the API is limited in how much you can send. You're also not allowed to send bulk emails or anything of that sort. Using Postmark responsibly rests on your shoulders.
Let me know what you think of it!