This documentation is archived and is not being maintained.

Sending E-mail Messages in Exchange 2010

Last modified: May 21, 2009

Applies to: Exchange Server 2007 | Exchange Server 2010

You can use Exchange Web Services to send items that have defined recipients.

The following example shows you how to send an item in the Exchange store.

static void SendEmail(ExchangeServiceBinding esb)
    // Create the SendItem request.
    SendItemType sit = new SendItemType();
    sit.ItemIds = new BaseItemIdType[1];

    // Create an item ID type and set the message ID and change key.
    ItemIdType itemId = new ItemIdType();

    // Get the ID and change key from the message that you obtained by using FindItem or CreateItem.
    itemId.Id = "AQAtA=";
    itemId.ChangeKey = "CQAAAB";

    sit.ItemIds[0] = itemId;

    // Send the message.
    SendItemResponseType siResponse = esb.SendItem(sit);
    // Check the result.
    if (siResponse.ResponseMessages.Items.Length > 0 &&
        siResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success)
        Console.WriteLine("Message with Id {0} and ChangeKey {1} is sent.", itemId.Id, itemId.ChangeKey);

The following XML example shows the XML request message that is sent from the client to the server.

<?xml version="1.0" encoding="utf-8"?>
<SendItem xmlns:xsi="" 
  <ItemIds xmlns="">
            xmlns="" />

The following XML example shows the XML response message that is sent from the server to the client.

<?xml version="1.0" encoding="utf-8"?>
<SendItemResponse xmlns:xsi="" 
  <ResponseMessages xmlns="">
    <SendItemResponseMessage ResponseClass="Success">

The SOAP messages that are passed between the Exchange Web Services client and server are defined by the XML schema and WSDL files. The XML schema and WSDL files define the contract between the client and server. Proxy class generators create an object-model abstraction of those SOAP messages, which can simplify programming. This code example uses a proxy class library that was generated by MicrosoftVisual Studio 2005. Different proxy class generators create different object models for a given Web service. This proxy class code example is an illustration only. Refer to the proxy class generator documentation for support for proxy classes.


The item identifier and change key have been shortened to preserve readability.

For information about compiling the code, see EWS Client Development in Exchange 2010.