0

I am using mailgun features to send email to clients using Adonis. I am sending two types of emails:

  1. Welcome Email - When the user signs up to my website.
  2. Orders Email - When the user orders an item.
    Now when someone replies to the mail(welcome or orders mail), I am receiving that that reply in my backend and storing it.
    My doubt is how to i know if the client replied to welcome email or orders email?
Angelin
  • 95
  • 1
  • 9
  • 2 (possible) solutions: 1) In emails there is in the headers a "messge id" either compare the message id or set a custom header with your own id to identify replys. 2) Set a id/number in the subect, with a fromat like `[xxxxxx] Welcome to xyz` and parse the subject. – Marc Jun 09 '21 at 08:49
  • Hi, Can you please help me out in figuring out how do I add custom headers or where? – Angelin Jun 09 '21 at 09:08
  • I dont know if its possible. Never worked with mailgon/adonis.js/cloudmailin. If its not possible to add/read the header fields, then you have to work with the subject approch. Seems like you can set custom headers with the mailgun package on npm: https://www.npmjs.com/package/mailgun#example i have to few informations to help you. – Marc Jun 09 '21 at 09:24
  • Read the docs: https://docs.cloudmailin.com/http_post_formats/json_normalized/#headers Im sure get very quickly to a possible solution. It seems every provider has what you need to achive this via custom headers. Read how a email is strutured (very similar to a html request/response) – Marc Jun 09 '21 at 09:34
  • okay, I'll go through this thank you :) – Angelin Jun 09 '21 at 09:48

0 Answers0