?
Solved

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

Posted on 2009-05-12
4
Medium Priority
?
692 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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
This article will help to fix the below errors for MS Exchange Server 2013 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
The viewer will learn how to count occurrences of each item in an array.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

752 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