Youans / nodejs-nodemailer-outlook

Simple integration module for outlook.office365 smtp servers
Apache License 2.0
36 stars 12 forks source link

NodeJS Nodemailer Outlook

Simple integration between node js and outlook.office365 emailing servers this project depends on Nodemailer library overriding its variables with outlook.office365 defaults.

Getting Started

Install module using following command :

npm install nodejs-nodemailer-outlook

In your file.js run the following

var nodeoutlook = require('nodejs-nodemailer-outlook')
nodeoutlook.sendEmail({
    auth: {
        user: "sender@outlook.com",
        pass: "********"
    },
    from: 'sender@outlook.com',
    to: 'receiver@gmail.com',
    subject: 'Hey you, awesome!',
    html: '<b>This is bold text</b>',
    text: 'This is text version!',
    replyTo: 'receiverXXX@gmail.com',
    attachments: [
                        {
                            filename: 'text1.txt',
                            content: 'hello world!'
                        },
                        {   // binary buffer as an attachment
                            filename: 'text2.txt',
                            content: new Buffer('hello world!','utf-8')
                        },
                        {   // file on disk as an attachment
                            filename: 'text3.txt',
                            path: '/path/to/file.txt' // stream this file
                        },
                        {   // filename and content type is derived from path
                            path: '/path/to/file.txt'
                        },
                        {   // stream as an attachment
                            filename: 'text4.txt',
                            content: fs.createReadStream('file.txt')
                        },
                        {   // define custom content type for the attachment
                            filename: 'text.bin',
                            content: 'hello world!',
                            contentType: 'text/plain'
                        },
                        {   // use URL as an attachment
                            filename: 'license.txt',
                            path: 'https://raw.github.com/nodemailer/nodemailer/master/LICENSE'
                        },
                        {   // encoded string as an attachment
                            filename: 'text1.txt',
                            content: 'aGVsbG8gd29ybGQh',
                            encoding: 'base64'
                        },
                        {   // data uri as an attachment
                            path: 'data:text/plain;base64,aGVsbG8gd29ybGQ='
                        },
                        {
                            // use pregenerated MIME node
                            raw: 'Content-Type: text/plain\r\n' +
                                 'Content-Disposition: attachment;\r\n' +
                                 '\r\n' +
                                 'Hello world!'
                        }
                    ],
    onError: (e) => console.log(e),
    onSuccess: (i) => console.log(i)
}

);

Options :

Built With

Versioning

Current version : 1.2.2

Authors

Links

Github

NPM

License

Apache 2.0 License.