Reputation: 1229
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?
Upvotes: 0
Views: 268
Reputation: 1
This Java code has worked for me to reply for recipient.
PropertySet propSet = new PropertySet(BasePropertySet.FirstClassProperties,ItemSchema.Body,ItemSchema.Subject,ItemSchema.Attachments, EmailMessageSchema.ParentFolderId);
EmailMessage beforeMessage = EmailMessage.bind(service, item.getId(), propSet);
ResponseMessage responseMessage = new ResponseMessage(beforeMessage,ResponseMessageType.Reply);
MessageBody bodyPrefix = new MessageBody();
bodyPrefix.setBodyType(BodyType.HTML);
bodyPrefix.setText("replied reminder 02");
responseMessage.setBodyPrefix(bodyPrefix);
List<EmailAddress> toRecipients = new ArrayList<EmailAddress>(){
{
add(new EmailAddress("[email protected]"));
}
};
responseMessage.getToRecipients()
.addEmailRange(toRecipients.iterator());
responseMessage.sendAndSaveCopy();
Upvotes: 0
Reputation: 9463
Probably all you need is to add your address to the EmailMessage.ReplyTo collection.
C# Examples:
emailMessage.ReplyTo.Add(new EmailAddress("[email protected]"));
emailMessage.ReplyTo.Add("[email protected]");
Java Examples (ews-java-api):
emailMessage.getReplyTo().add(new EmailAddress("[email protected]"));
emailMessage.getReplyTo().add("[email protected]");
Upvotes: 2