positive-outlook
v0.3.0
Published
Client for Microsoft Exchange Web Services
Downloads
1
Readme
positive-outlook
Simple EWS client.
Installation
npm i --save positive-outlook
Usage
import ExchangeClient, { Folder, Mailbox, Message } from 'positive-outlook';
const client = new ExchangeClient({
username: '[email protected]',
password: 'correct horse battery staple',
domain: 'ADMIN',
strictSSL: false, // in case you can't trust the certs
});
client.on('ready', () => {
const inbox = Folder.Inbox();
client::inbox.list().then(response => {
response.messages.forEach(m => {
console.log(m.isRead === 'true' ? ' ' : ' [unread] ', m.subject);
});
});
const recipients = Mailbox.fromAddresses([
'[email protected]',
'"Brian Bar" <[email protected]>',
]);
const message = new Message({
to: recipients,
subject: 'Hello world',
body: 'Sending email via Node.js',
});
client::message.send().catch(err => console.error(err));
});
The API should be considered very unstable at this point. Once I've wrapped my head around most of the EWS API then you can start expecting some stability.
If you can't use the "bind" notation (::
) then you can call
the methods, e.g.:
inbox.list.call(client).then(/* ... */);
message.send.call(client).catch(/* ... */);