C# code : Exchange says OK but doesn't send email RRS feed

  • Question

  • Dear Exchange community,

    I need your help for the following issue :

    I execute some C# code below for asking Exchange 2007 to send some emails, i get some positive answer from Exchange, BUT, i never receive the email.

    Question : is there some missing configuration on my Exchange server, or some missing instruction in my C# code ?

    Log in Exchange side, which shows Exchange receives my request :

    C:\Program Files\Microsoft\Exchange Server\TransportRoles\Logs\MessageTracking :


    Answer from Exchange :

    <ResponseMessage ResponseClass="Success">
    <Trace Tag="EwsRequestHttpHeaders" Tid="9" Time="2014-04-25 09:12:23Z">
    POST /ews/exchange.asmx HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    Accept: text/xml
    User-Agent: ExchangeServicesClient/14.03.0032.000
    Accept-Encoding: gzip,deflate
      <m:CreateItemResponseMessage ResponseClass="Success">
        <m:Items />

    C# code :
    static void Main(string[] args)
               ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;
       string log = "";
       exchange_service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
       exchange_service.TraceEnabled = true;
       exchange_service.TraceFlags = TraceFlags.All;
       exchange_service.Credentials = new WebCredentials(userName, userPassword, domain);
       exchange_service.Url = new Uri("https://" + exchangeServerAddr + "/ews/exchange.asmx");
       if (null != exchange_service.ServerInfo)
           Console.WriteLine("Exchange server: " + exchange_service.ServerInfo.VersionString);
           EmailMessage email = new EmailMessage(service);
           email.Subject = "HelloWorld";
           email.From = from;
           email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API.");



    • Edited by Dumond Friday, April 25, 2014 10:03 AM
    Friday, April 25, 2014 9:43 AM

All replies

  • So, the answer is : the email sender must belonging to the same Exchange server than the receiver. Both emails must having the same suffixe.

    That's all.

    I thank you myself for my precious cooperation.

    Friday, April 25, 2014 6:15 PM