javaemailexchange-serverexchangewebservices

Is there a method to set the replyTo header of an email using Exchange Web Service (EWS)?


I have been using the Exchange Web Service EWS v2.0 API for email processing in a Java based web application. I am trying to explore the options to set the Reply-To header using this but there does not seem to be any way to achieve this. Is there any possibility to do so?


Solution

  • Probably all you need is to add your address to the EmailMessage.ReplyTo collection.

    C# Examples:

    emailMessage.ReplyTo.Add(new EmailAddress("someone@sample.com"));
    emailMessage.ReplyTo.Add("someone@sample.com");
    

    Java Examples (ews-java-api):

    emailMessage.getReplyTo().add(new EmailAddress("someone@example.com"));
    emailMessage.getReplyTo().add("someone@example.com");