UNPKG

ikmail

Version:

A tiny librairy to send emails with nodejs, using Infomaniak smtp service. Using modules.

49 lines (35 loc) 1.49 kB
# Ikmail A tiny librairy to send emails with nodejs, using Infomaniak smtp service. <span style="color: #E76C60">Using <strong style="text-decoration: underline">ES6 modules</strong>. Not working with require().</span> ## Installation ```bash npm install ikmail ``` ## Usage ```javascript import { Mailer } from 'ikmail' const mailer = new Mailer('your@domainname.com', 'YourSuperStrongPassword001') // param1: your email // param2: your password mailer.send('the@recipient.com', 'Name', 'Test', '<p>Test</p>', (res, data) => { console.log(res, data) }) // param1: recipient email // param2: your display name // param3: email subject // param4: email content ( html ) // param5: callback ``` ## Callback | Argument | Type | Description | | -------- | ------ | --------------------------------------------------------------------------- | | res | string | Can be: `'error'`, `'sended'` or `'retry'`. | | data | any | If res is `'error'`, data is the error. If res is `'sended'`, data are the informations. If res is `'retry'`, data is `null` | ## Callback: res | Value | Description | | -------- | ------ | | `'error'` | An error occured. | | `'sended'` | Email sended. | | `'retry'` | Email sended but with wrong informations. | ## License [MIT](https://choosealicense.com/licenses/mit/)