Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JWebDAV for Exchange
>
Tutorial
> Send message as another user
The following example shows you how to send message as another user.
import java.io.IOException; import com.independentsoft.webdav.exchange.Mailbox; import com.independentsoft.webdav.exchange.Message; import com.independentsoft.webdav.exchange.WebdavClient; import com.independentsoft.webdav.exchange.WebdavException; public class Example { public static void main(final String[] args) { try { WebdavClient client = new WebdavClient("https://myserver/exchange/emailaddress", "username", "password"); Message message1 = new Message(); message1.setSubject("Test"); message1.setBody("Message body text."); message1.setTo("Mark@mydomain.com"); Mailbox johnMailbox = client.getMailbox("http://myserver/exchange/John@mydomain.com"); client.sendMessage(johnMailbox, message1); } catch (WebdavException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }