Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Is is possible (using code to query) to embed a small piece of text into an email message that will persist with the message but not be visible or changeable (perhaps in the header or something)?

It needs to persist and be retrievable from the Sent folder in Outlook.

FYI: We use a FoxPro application to create the message and C# to query Outlook.
Posted
Updated 29-Apr-11 6:50am
v5
Comments
Sergey Alexandrovich Kryukov 29-Apr-11 12:49pm    
Good thinking, so my 5 for the question but...
Please see my solution.
--SA

1 solution

In principle, absolutely everything in the e-mail is both visible and modifiable. E-mail related standards are notoriously ignorant about any kind of protection against any kind of forgery. All you can do is encryption.

However, you can hide some data (such as something you want to process as meta-data) the way some e-mail agent will not show. This is all you can do. With a little effort and minimal qualification anyone can get an e-mail using lower-level (for example, by acting as a client of SMTP server directly) and read a raw e-mail with all headers, "hidden" or not. The e-mail in its raw format is exactly the same as .EML file, so if someone is using a e-mail client which can save a message as .EML will also see all the raw data.

So, I'm not sure you want to waste time on it. If you want — this is pretty usual activity. There are so many such "meta-data" headers for doing that. For example, I found the header "X-Facebook" :-). You can add something like that on your own — all available e-mail software will simply ignore it and pass as is.

Again, there is nothing to protect it from access.

Now, what about encryption?

With encryption you can make it visible and modifiable, but interpretation (deciphering) would be impossible. With public-key encryption you can use the principle of digital signature which also would make the forgery of the "secret" meta-data impossible. At least if this header is removed, you can detect it as well as the attempt of mangling (forging) of this piece of data.
If you're interested in such encryption, read:
http://en.wikipedia.org/wiki/Public-key_cryptography[^],
http://en.wikipedia.org/wiki/Digital_signature[^].

[EDIT]

About the use of MAPI; can these articles help you:
Using MAPI properties and events in .NET with the MAPI Store Accessor[^],
Simple MAPI.NET[^]?

I believe you will be able to find a lot more on this topic.

—SA
 
Share this answer
 
v6
Comments
Troy Murphy 29-Apr-11 12:59pm    
Thank you for such a quick response. I am not concerned about someone trying to remove it explicitly, we just don't want it visible as it is meaningless to the recipient. I think you are pointing me in the right direction by adding headers. Do you have any resources you can share that will show me how to do that via MAPI?
Sergey Alexandrovich Kryukov 29-Apr-11 13:12pm    
Well, you did not even tag platform/language(s) you're interesting in... (I suggest you always do it, even if you work on multiple platforms.)

No, and you probably don' need it. There is nothing specific to MAPI here, all you need is reading and writing headers; I saw many references here on CodeProject Questions-and-Answers as well as articles with samples. Just search CodeProject -- this is a good resource, especially on those topics. I mostly work on C# (where comprehensive e-mail functionality is provided by the standard library) but -- to my shame -- I mostly did e-mail stuff with PHP (I use inexpensive hosting).

I'm pretty much sure I gave you a sketch on every way you can use.
So, are you going to use cryptography or not?
This is the only delicate moment in the architecture (but implementation is not difficult, depending on what you use). Anyway, your follow-up questions are welcome.

Thank you for accepting this answer (a vote would not hurt as well).
Good luck, call again.
--SA
Sergey Alexandrovich Kryukov 29-Apr-11 13:20pm    
OK, I see added C# tag. You won't have any problems. .NET supports all you need comprehensively; and you can find plenty of code samples if you do you search in CodeProject and/or elsewhere.

Good luck.
--SA
Troy Murphy 29-Apr-11 13:36pm    
Thank you again - this is my first time posting (I think) but I will certainly vote! The C# part (reading headers) is easy, it is the VFP side (writing headers) that I have to research: it is using the loMapiMessage=CREATEOBJECT('MSMAPI.MapiMessages') construct.
Sergey Alexandrovich Kryukov 29-Apr-11 13:59pm    
You're welcome
I don't think it's a big deal. I added a couple of references on MAPI (see the updates Solution after [EDIT]).

Good luck, call again.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900