Mailspring/packages/isomorphic-core/index.js
Karim Hamidou 683a550d49 [feat] Add support for send later
Summary:
Finally, here it is! Send later, with support for open tracking but without support for attachments yet. It took me some time to find the right way to do things.

**The send later dilemna**

There's two ways we could handle send later:
1. do everything on the client
2. process the message in the cloud

1. is very tempting because it would make the cloud server very simple. Unfortunately, it has some serious limitations, for example, setting the "Date" message header. That's why I chose to go with 2. When a user presses the "Send Later" button, we save the open/link tracking metadata and fills in all the required fields. I added a custom endpoint to the K2 API to do this, `/drafts/build`. After that, we save the JSON contents of the message as metadata.

When we process metadata, we simply create a MIME message from the JSON and send it.

**Limitations**

Right now, send later doesn't support and attachments. There's also some minor code duplication which needs to be refactored away.

Test Plan: Tested manually. Checked that regular send still worked, too.

Reviewers: mark, spang, halla, juan, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D4054
2017-03-07 16:06:30 -08:00

27 lines
1.1 KiB
JavaScript

/* eslint global-require: 0 */
module.exports = {
Provider: {
Gmail: 'gmail',
IMAP: 'imap',
},
Imap: require('imap'),
Errors: require('./src/errors'),
IMAPErrors: require('./src/imap-errors'),
loadModels: require('./src/load-models'),
AuthHelpers: require('./src/auth-helpers'),
PromiseUtils: require('./src/promise-utils'),
DatabaseTypes: require('./src/database-types'),
IMAPConnection: require('./src/imap-connection'),
IMAPConnectionPool: require('./src/imap-connection-pool'),
SendmailClient: require('./src/sendmail-client'),
DeltaStreamBuilder: require('./src/delta-stream-builder'),
HookTransactionLog: require('./src/hook-transaction-log'),
HookIncrementVersionOnSave: require('./src/hook-increment-version-on-save'),
BackoffScheduler: require('./src/backoff-schedulers').BackoffScheduler,
ExponentialBackoffScheduler: require('./src/backoff-schedulers').ExponentialBackoffScheduler,
MetricsReporter: require('./src/metrics-reporter').default,
MessageFactory: require('./src/message-factory'),
SendUtils: require('./src/send-utils'),
executeJasmine: require('./spec/jasmine/execute').default,
}