[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

How to obtain the "message-id" of the emails just sent out?

Posted on 2009-05-12
4
Medium Priority
?
704 Views
Last Modified: 2013-12-17
I am working on an application, which sends out emails through Exchange server, and track and process the replies. In order to link the reply with the original outbound email, we need to know the "message-id" field of the emails sent out.

The email sending and receiving are done with WebDAV calls. Does someone know the answer?
0
Comment
Question by:nbkd72e
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Expert Comment

by:abhaigh
ID: 24372766
the field you are wanting to capture is the 'Message-ID:' field

it will look like this in the smtp headers

Message-ID: <DD3A01CC964AA34B80CCB895A38B0241DC4F02@mx.domain.com>
0
 

Author Comment

by:nbkd72e
ID: 24374925
How to obtain the SMTP headers? Our applications access Exchange server through OWA and WebDAV.
0
 
LVL 15

Accepted Solution

by:
abhaigh earned 2000 total points
ID: 24375955
I found this - perhaps it will help you

Re: Find CDO Message.ID with WebDAV
http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2004-07/0151.html

Now I found the problem myself, here is the solution:

String query = "<?xml version=\"1.0\"?>"
+ "<g:searchrequest xmlns:g=\"DAV:\">"
+ "<g:sql>SELECT
\"http://schemas.microsoft.com/mapi/proptag/0x0FFF0102\"
AS entryId "
+ "FROM Scope('SHALLOW TRAVERSAL OF \"" + folderUri
+ "\"') "
+ "WHERE \"DAV:contentclass\" = 'urn:content-
classes:task' "
//+ additional wheres
//send the query, parse results ...

byte[] bytes = Convert.FromBase64String( entryId );
String taskID = String.Empty;
String currentNumber;
foreach(byte b in bytes){
        currentNumber = b.ToString("X");
        if(currentNumber.Length == 1){
                currentNumber = "0"+currentNumber;
        }
        taskID += currentNumber;
}

session.Logon(defaultProfileName, "", false, false,
Missing.Value, Missing.Value, Missing.Value);
MAPI.Folder taskFolder = (MAPI.Folder)
session.GetDefaultFolder(8);

MAPI.Message message = (MAPI.Message)session.GetMessage
(taskIDs[1], infoStoreID);
Console.WriteLine(message.Subject.ToString());

session.Logon(defaultProfileName, "", false, false,
Missing.Value, Missing.Value, Missing.Value);
MAPI.Folder taskFolder = (MAPI.Folder)
session.GetDefaultFolder(8);

MAPI.Message message = (MAPI.Message)session.GetMessage
(taskIDs[1], infoStoreID);
Console.WriteLine(message.Subject.ToString());
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question