How to integrate incoming e-mail into .NET app RRS feed

  • Question

  • Hello,

    not sure it's the right forum, but I have .NET app, Winforms UI and WCF/SQL DB on backend.

    User can send e-mails from the app (via SMTP) which is also stored in the DB. We use Exchange and Outlook.

    Need to be able to "tag" outgoing messages sent from the app, so when reply comes back we're able to detect that it's related to original message and store it in the DB associated with the original e-mail.

    Any suggestions on approach?



    Wednesday, May 13, 2015 4:12 PM

All replies

  • Your mail message is present in a database, and your using your app to smtp send that email.

    I suggest you add a trace / audit table that should be "filled" every time your smtp send a mail that is present in the database.

    You want that table to reference your email primary key (id), date and any other pertinent informations..

    Wednesday, May 13, 2015 8:24 PM
  • I guess I didn't phrase the question right.

    What do I do on Exchange side to recognize "tagged" messages and "send" them to my application to store in DB. I need to keep conversation in DB, not just outgoing but also incoming messages.

    Are there any Exchange APIs? How can "mark" outgoing messages(may be in the e-mail Header) so they can be recognized as part of the conversation?



    Wednesday, May 13, 2015 8:47 PM
  • I think Exchange will automatically line them up in conversation with same Thread-Topic and Thread-Index SMTP header.
    Thursday, May 14, 2015 2:14 AM
  • Refer following link

    You can also use MessageID to identify in incoming email

    Gaurav Khanna | Microsoft .NET MVP | Microsoft Community Contributor

    Thursday, May 14, 2015 3:37 AM
  • Thank you, no luck yet. Tried custom X-header, but it got removed by Gmail in reply message.

    Tried MessageID, but it's gone if email is forwarded.

    Tried address+{unique-id}, but it's invalid address and reply cannot be delivered.

    I didn't see Thread-Topic and Thread-Index in the message header.

    Is there any other solution to monitor inbox and recognize related MailMessages?

    Thank you


    Friday, May 15, 2015 7:14 PM
  • Try send one email in Outlook, then reply the message. You should be able to see the headers automatically added in there in Outlook 2003+.

    As this is a "Microsoft only" header, do not expect it to work on other mail clients.

    Saturday, May 16, 2015 1:33 PM