Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Outlook email
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 29-Apr-11 6:59am
Edited 29-Apr-11 7:50am
thatraja242.2K
v5
Comments
SAKryukov at 29-Apr-11 12:49pm
   
Good thinking, so my 5 for the question but...
Please see my solution.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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" Smile | :) . 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
  Permalink  
v6
Comments
Troy Murphy at 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?
SAKryukov at 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
SAKryukov at 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 at 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.
SAKryukov at 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)

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 273
2 Aajmot Sk 234
3 Marcin Kozub 205
4 Richard MacCutchan 200
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,127
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 29 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100