emailsmtpimapemail-headersemail-delivery

Send en email programmatically but an response should come to a user


We're building a web app which contains a form of what documents to request from a client. So

  1. A user ticks for example driver license, passport and application letter on that form and click "Send document request".
  2. The application sends an email to the client which says "Please send us your 1) driver license 2) passport 3) application letter". It sends the email using it's own robot account like "noreply@ourcompany.com"
  3. The client gets the email asking him to reply back with requested documents. He replies on that email with text like "Ok, great, thanks! I have attached my driver license, passport and letter to this letter" and attaches the files.
  4. The user from the first step should get the letter client sends on the third step.

How can I achieve the behavior on the fourth step? I guess there is something like 'Reply-To' header I should set to the real user's email.


Solution

  • I've created an example for you to confirm the logic. Please add feedback to comments and I'll edit accordingly. The idea here is that with your feedback, we can create a Narrative of emails to form a complete and successful conversation.

    Does the following logic matches your intent?

    1. An email is ACCEPTED via HTML form FROM "User1" <user1@example.com>
    2. This email is ORIGINALLY SENT FROM "No-Reply" <noreply@ourcompany.com>
    3. This email is SENT TO "User2" <user2@example.com>
    4. ANY replies to This email ARE in REPLY-TO "User1" <user1@example.com>
    5. ...is this correct?

    If so, here's a working example of a text/plain email including headers + content:

    From: "No-Reply" <noreply@ourcompany.com>
    To: "User2" <user2@example.com>
    Reply-To: "User1" <user1@example.com>
    Subject: Document Request
    MIME-Version: 1.0 (Created with SublimeText 3)
    Content-Type: text/plain; charset="us-ascii"
    Content-Transfer-Encoding: 7bit
    
    Good morning, User2.
    
    Please send us your 1) driver license 2) passport 3) application letter.
    
    
    Thank you,
    
    Ourcompany Inc.
    

    IMAGE1