Home / Companies / Postmark / Blog / Post Details
Content Deep Dive

Handling inbound emails in Rails using Postmark

Blog post from Postmark

Post Details
Company
Date Published
Author
Matt West
Word Count
1,356
Language
English
Hacker News Points
1
Summary

To receive emails in a Rails app using Postmark's inbound email processing, one needs to set up a Postmark account and configure it to forward incoming emails to a specific server. This server must be configured with an inbound email address that can be used to identify which articles a response should be associated with. The article ID is added to the email address by appending a '+' symbol. A Rails app must then create a controller method, such as `create`, to handle the incoming webhook payloads sent by Postmark. This method parses the JSON payload, extracts the article ID and user information, creates a new response record in the database, and returns a 200 response code. The `create` method must be configured to disable CSRF protection on the webhook endpoint. A route must also be set up for the controller action. Once all these steps are completed, the Rails app can receive and process incoming email responses from users.