Skip to content

Commit

Permalink
📔 Documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-dimitru committed Apr 14, 2024
1 parent ee535ea commit 8b61d62
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ The main difference between *Server* and *Client* `type` is that the *Server* ha
- [Installation](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#installation)
- [Meteor.js usage](https://github.com/veliovgroup/mail-time/blob/master/docs/meteor.md)
- [Usage example](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#basic-usage)
- [Initiate with MongoDB for queue and scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-mongodb-for-queue-and-scheduler)
- [Initiate with MongoDB for queue and Redis for scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-mongodb-for-queue-and-redis-for-scheduler)
- [Initiate with Redis for queue and MongoDB for scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-redis-for-queue-and-mongodb-for-scheduler)
- [Initiate with Redis for queue and scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-redis-for-queue-and-scheduler)
- [Require/Import `mail-time`](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#1-require-package)
- [Create NodeMailer's transports](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#2-create-nodemailers-transports)
- [Initiate `mail-time`](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#3-initiate-mail-time)
- [Connect to Redis](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#3a-initiate-and-connect-to-redis)
- [Connect to MongoDB](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#3b-initiate-and-connect-to-mongodb)
- [Initiate as *Client* instance](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#3c-optionally-create-client-type-of-mailtime)
- [Initiate two `MailTime` instances within the single app](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#two-mailtime-instances-usage-example)

- [Use templates](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#passing-variables-to-the-template)
- Different storage configurations:
- [Use MongoDB for queue and scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-mongodb-for-queue-and-scheduler)
- [Use MongoDB for queue and Redis for scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-mongodb-for-queue-and-redis-for-scheduler)
- [Use Redis for queue and MongoDB for scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-redis-for-queue-and-mongodb-for-scheduler)
- [Use Redis for queue and scheduler](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#using-redis-for-queue-and-scheduler)
- [API](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#api)
- [`new MailTime` *Constructor*](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#new-mailtimeopts-constructor)
- [`new RedisQueue` *Constructor*](https://github.com/veliovgroup/mail-time?tab=readme-ov-file#new-redisqueueopts-constructor)
Expand Down Expand Up @@ -379,8 +387,8 @@ await mailQueue.sendMail({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below MongoDB is used for both

```js
import { MongoClient } from 'mongodb';
import { MailTime, MongoQueue } from 'mail-time';
import { MongoClient } from 'mongodb';
import { transports } from './transports.js';

const db = (await MongoClient.connect('mongodb://url')).db('database');
Expand Down Expand Up @@ -408,8 +416,8 @@ const mailQueue = new MailTime({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below MongoDB is used for queue and Redis is used for scheduler

```js
import { MongoClient } from 'mongodb';
import { MailTime, MongoQueue } from 'mail-time';
import { MongoClient } from 'mongodb';
import { createClient } from 'redis';
import { transports } from './transports.js';

Expand All @@ -435,8 +443,8 @@ const mailQueue = new MailTime({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below Redis is used for queue and MongoDB is used for scheduler

```js
import { MongoClient } from 'mongodb';
import { MailTime, RedisQueue } from 'mail-time';
import { MongoClient } from 'mongodb';
import { createClient } from 'redis';
import { transports } from './transports.js';

Expand All @@ -462,8 +470,8 @@ const mailQueue = new MailTime({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below Redis is used for both

```js
import { MongoClient } from 'mongodb';
import { MailTime, RedisQueue } from 'mail-time';
import { MongoClient } from 'mongodb';
import { createClient } from 'redis';
import { transports } from './transports.js';

Expand Down Expand Up @@ -719,6 +727,19 @@ new MongoQueue({

- `uuid` {*string|promise*} — email's `uuid` returned from `.sendEmail()` method

```js
import { mailQueue } from './mail-queue.js';

const uuid = await mailQueue.sendMail({
to: '[email protected]',
subject: 'Email subject',
text: 'You have got email!',
html: '<p>You have got email!</p>',
});

await mailQueue.cancelMail(uuid);
```

### `static MailTime.Template`

Simple and bulletproof HTML template, see [its source](https://github.com/veliovgroup/mail-time/blob/master/template.html). Usage example:
Expand Down
12 changes: 6 additions & 6 deletions docs/meteor.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Install [Atmosphere `ostrio:mailer` package](https://atmospherejs.com/ostrio/mai
meteor add ostrio:mailer
```

Import `'meteor/ostrio:mailer'` package
Import `meteor/ostrio:mailer` package

```js
import { MailTime, MongoQueue, RedisQueue } from 'meteor/ostrio:mailer';
Expand Down Expand Up @@ -56,8 +56,8 @@ export { transports };
*MailTime* uses separate storage for Queue management and Scheduler. In the example below MongoDB is used for both

```js
import { MongoInternals } from 'meteor/mongo';
import { MailTime, MongoQueue } from 'meteor/ostrio:mailer';
import { MongoInternals } from 'meteor/mongo';
import { transports } from './transports.js';

const mailQueue = new MailTime({
Expand Down Expand Up @@ -90,8 +90,8 @@ const mailQueue = new MailTime({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below MongoDB is used for queue and Redis is used for scheduler

```js
import { MongoInternals } from 'meteor/mongo';
import { MailTime, MongoQueue } from 'meteor/ostrio:mailer';
import { MongoInternals } from 'meteor/mongo';
import { createClient } from 'redis';
import { transports } from './transports.js';

Expand All @@ -117,8 +117,8 @@ const mailQueue = new MailTime({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below Redis is used for queue and MongoDB is used for scheduler

```js
import { MongoInternals } from 'meteor/mongo';
import { MailTime, RedisQueue } from 'meteor/ostrio:mailer';
import { MongoInternals } from 'meteor/mongo';
import { createClient } from 'redis';
import { transports } from './transports.js';

Expand All @@ -144,8 +144,8 @@ const mailQueue = new MailTime({
*MailTime* uses separate storage for Queue management and Scheduler. In the example below Redis is used for both

```js
import { MongoInternals } from 'meteor/mongo';
import { MailTime, RedisQueue } from 'meteor/ostrio:mailer';
import { MongoInternals } from 'meteor/mongo';
import { createClient } from 'redis';
import { transports } from './transports.js';

Expand Down Expand Up @@ -184,7 +184,7 @@ REDIS_URL="redis://127.0.0.1:6379" meteor test-packages ./ --driver-package=mete
EMAIL_DOMAIN="example.com" REDIS_URL="redis://127.0.0.1:6379" meteor test-packages ./ --driver-package=meteortesting:mocha

# In case of the errors, — enable DEBUG for detailed output
DEBUG="true" REDIS_URL="redis://127.0.0.1:6379" meteor test-packages ./ --driver-package=meteortesting:mocha
DEBUG="true" REDIS_URL="redis://127.0.0.1:6379" meteor test-packages ./ --driver-package=meteortesting:mocha

# With custom port
REDIS_URL="redis://127.0.0.1:6379" meteor test-packages ./ --driver-package=meteortesting:mocha --port 8888
Expand Down

0 comments on commit 8b61d62

Please sign in to comment.