Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JWebServices for Exchange
>
Tutorial
> Send message
The following example shows you how to send message.
import com.independentsoft.exchange.Body; import com.independentsoft.exchange.ItemInfoResponse; import com.independentsoft.exchange.Mailbox; import com.independentsoft.exchange.Message; import com.independentsoft.exchange.Service; import com.independentsoft.exchange.ServiceException; public class Example { public static void main(String[] args) { try { Service service = new Service("https://myserver/ews/Exchange.asmx", "username", "password"); Message message = new Message(); message.setSubject("Test"); message.setBody(new Body("Body text")); message.getToRecipients().add(new Mailbox("John@mydomain.com")); message.getCcRecipients().add(new Mailbox("Mark@mydomain.com")); ItemInfoResponse response = service.send(message); } catch (ServiceException e) { System.out.println(e.getMessage()); System.out.println(e.getXmlMessage()); e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*