0

I'm working on a support app which would allow customers to mail to support@myapp.com 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 support@myapp.com. When the customer replies to support@myapp.com, 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.

daphsta
  • 25
  • 3

1 Answers1

0

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 <sender@example.com>
------cloudmailinboundry
Content-Disposition: form-data; name="headers[To]"

Cloudmailin headers file

Kelz
  • 494
  • 4
  • 9
  • So, when sending the email, do I set the headers['Reply-To'] = ticketID? – daphsta Jul 29 '13 at 03:58
  • Yup. You may need to authorize your entire domain in case it is not with SendGrid, otherwise you may end up in somebodies spam filter - (I'm not too familiar with SendGrid but it is a pretty common problem that most outgoing email providers have solved). – Kelz Jul 29 '13 at 04:17
  • Thanks for that tip of authorizing the domain. Still a little confused about Reply-To headers, when the customer hit reply , they will be able to see the Reply-To email address which would be something like Ticket+id@myapp.com? – daphsta Jul 29 '13 at 04:24
  • Yes they will - you can even just leave reply-to null and set the sender as the ticker+id@myapp.com address. – Kelz Jul 29 '13 at 04:28
  • would including this info in Message-ID be an option? – daphsta Jul 29 '13 at 08:02
  • Message-ID is supposed to be unique for each individual email sent, and it isn't guaranteed that an email provider wouldn't wipe it. – Kelz Jul 29 '13 at 17:21
  • Thanks for the advice Kelz. Will experiment with Reply-To headers then – daphsta Jul 30 '13 at 02:55