Token

Hi guys,



I need a tip or suggestion:



I would like to place some kind of token (e.g. a GUID) in an email which I will get back when the receiver replies to my email.



The trivial approach is to put this token in the email text. The problem is that some users deleted it before they sent their reply :wink:



So, I was wondering if there is a best practice to somehow ā€œhideā€ this token and still make sure that I will get it back.



I hope you can help me out.



Thanks

Ingmar

Hi Ingmar,


Sorry for a delayed response.

I was unable to find any such method where the token can be retrieved automatically with the userā€™s reply. The use of message headers also doesnā€™t seem to be workable as the message headers are stripped off at senderā€™s end and new headers are added from the sender end.

Iā€™ll contact our development team to get their opinion if this can be achieved using the API, and will get back to you then. Thanks for your patience till then.

Hi Ingmar,


I would like to share with you that there is no such way to store the token and get it back in reply from the user. We analyzed any such possibility using the message headers as well, but since message headers are stripped off and new headers added at sendersā€™ end, so this canā€™t be used. Moreover, it is not sure that the header from the senderā€™s end will always be saved.

By the way, itā€™s a common observation that while replying to an email, users often donā€™t change the subject and that may help you to get back your token number from the Subject. Itā€™s just a suggestion that may work for you.

Hi Kashif,



too bad :frowning:



Using the ā€œsubjectā€ was one thought that I already had too. I guess I will go for it.



Thank you very much fĆ¼r your researches!!!

Ingmar

Hi Ingmar,

I have done some more investigation in this regard and would like to share my findings with you.

Please have a look at the highlighted header fields in the following information. The highlighted fields References and Mesage-ID may be used in combination to achieve this objective if custom GUID is not a requirement. If you have a look at the References field, it contains reference to the original email to which this email message is a reply. Also, the Message-ID is unique for all the emails that are received. I think this can be somewhat achieved by using these fields, though needs a little more R&D as the existence of both these fields need to be guarenteed.

MIME-Version: 1.0
Received: by 10.49.81.164 with HTTP; Mon, 28 Jan 2013 07:14:49 -0800 (PST)
In-Reply-To: <001a01cdfd57$3c1b0c00$b4512400$@aspose.com>
References:
<001a01cdfd57$3c1b0c00$b4512400$@aspose.com>
Date: Mon, 28 Jan 2013 20:14:49 +0500
Delivered-To: ******@gmail.com
Message-ID:
Subject: Re: Inquiry about "To" field
From: Kashif Iqbal
To: Dmitry <*****.sa*****@aspose.com>
Cc: Andrey
Content-Type: multipart/alternative; boundary=047d7b6d7d7cfcc0ac04d45abc1e

--047d7b6d7d7cfcc0ac04d45abc1e
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

In addition, I think setting the GUID in Subject or From, as shown in following code, fields may help you achieve your objectives.

MailMessage mailMsg = new MailMessage();
mailMsg.From = "Token 123 ";
mailMsg.To = "Receiver@gmail.com";
mailMsg.Subject = "Test Subject";
mailMsg.Body = "Test Body";

Hello Kashif,



I really appreciate that you didnā€™t give up researching. And your solution is very interesting.



Except, how do I get access to the Message-ID of the original email? I believe that Message-ID is assigned when I send the email, right? But at that point I have no access to it anymore. Or do I? Well, I will try a few things.



Thanks again!

Ingmar

Hi Ingmar,

I have done little more investigation and following are my findings:

  1. I sent mail from user01 to user02. Following is found in the SENT folder of user01

Message-ID: <**[510d4d6e.ed14b40a.68d8.2597@mx.google.com](mailto:510d4d6e.ed14b40a.68d8.2597@mx.google.com)**>

Date: Sat, 02 Feb 2013 09:31:26 -0800 (PST)

  1. user02 replies to this mail. Following is found in INBOX of user01.

In-Reply-To: <510d4d6e.ed14b40a.68d8.2597@mx.google.com>
References: <510d4d6e.ed14b40a.68d8.2597@mx.google.com>
Date: Sat, 2 Feb 2013 22:31:52 +0500
Message-ID:

  1. user01 again replies to this response and in return user02 replies second time. Following is found in INBOX of user01.

In-Reply-To:
References: <510d4d6e.ed14b40a.68d8.2597@mx.google.com>

Date: Sat, 2 Feb 2013 22:33:27 +0500
Message-ID:

Here we can see that a reference is always maintained in the consecutive replies since a mail is sent from the source. In the above example "510d4d6e.ed14b40a.68d8.2597@mx.google.com" is the unique reference which can be used to keep track of individual mail and respective conversation.

I have also observed that on receiver end (user02) same unique reference is maintained for all the mails under this conversation.

Please analyze the above information and let us know your feed back.

Good morning Kashif,



those are really great findings. And thank you so much for your effort.



The thing is - and I should have been more precise about this in my previous posting - I donā€™t think there are physical files being created (eml or something else ) when my application sends its emails. Or does it?



I am creating an email object in memory, and then just send it with the buit-in ā€œDefault SMTP Virtual Serverā€ of my IIS6. I donā€™t know which ā€œuserā€ is being used in this context. Maybe ā€œNetwork Serviceā€ or ā€œLocal Serviceā€? I donā€™t know. In any case I could not find a ā€œSentā€ folder for email. But maybe I was not looking at the right places.



But before even going into accessing a file after sending an email, it would be super nice if the email object of the original email had the newly created Message-ID stored in one of its properties - right after I send the email. This way I would not have to think of accessing the corresponding file (if there is one at all).



I understand that I only need the original Message-ID. From there on, whenever a receiver replies, I can just walk the list of references in order to figure out which emails belong together.



So, if you know an easier way to get the original Message-ID (other than accessing a file) - or maybe a way to set one on your own - this would be a perfect solution then.



Thanks again so much for your effort!

Ingmar

Hi Ingmar,


Thanks for the details.

I am afraid but I have never been through these much details of SMTP virtual server on IIS, as the working experience is based on publicly available servers such as Gmail and Exchange servers.

Regarding the Message-ID, as I stated earlier it is something that is assigned to a message by the server when the email has been sent out. So, it isnā€™t possible to keep this ID other than retrieving it by accessing it from the Sent Items folders, as these are set by the Sending Server. The RFC2822 - Internet Message Format provides enough information about the specificaitons of a Message-ID.

Please note one thing here: Though I couldnā€™t find any such instance where the Message-ID or References field is NULL/Not available, but still it is mentioned online on various forums (such as HERE) that it is an optional field.

Hello Kashif,



since Iā€™m not connecting to a real email account I donā€™t have persistent folders and files such as Inbox, Sent, etc.



But it is great that you found out about the whole Message-ID/References stuff. Maybe I will have use for this in another project.



So, thank you very much again for your help!