How should I pass info through email headers in Rails 3

296 views Asked by At

I'm working on a support app which would allow customers to mail to [email protected] and reply to this same email address. I have set up ticket+[id]@myapp.com to be visible within the support team whenever there's a new ticket created. I am using Cloudmailin for the incoming emails and SendGrid for outgoing.

I want to be able to store the ticket ID in the email headers of the email that is sent to the customer from [email protected]. When the customer replies to [email protected], the app will then read the headers and know which ticket ID to route to. I have read up that it is not recommended to include X-custom headers as it would get stripped off by some mail servers.

There are some suggestions to use the Reply-To header to store the ticket ID but I can't seem to find that header in Cloudmailin.

Appreciate any suggestion on this matter.

1

There are 1 answers

7
Kelz On

I think you have the right idea in using the +'s to differentiate the emails. To read the incoming email header, you can use the headers[to] in cloudmailin.

Message Sender <[email protected]>
------cloudmailinboundry
Content-Disposition: form-data; name="headers[To]"

Cloudmailin headers file