[cloud-core, cloud-workers, isomorphic-core] Fix sending from cloud-workers

Summary:
The SendmailClient is in isomorphic-core, but wasn't working properly when
called from cloud-workers. This diff includes a variety of fixes to get it
working:

  - Add smtp config to connection settings in cloud-core
  - Don't use `PromiseUtils.promisify` for a function that needs `this` to
    be bound properly
  - Don't reference `NylasEnv` (That error gets caught and reported
    elsewhere anyway, we don't need to report it here)
  - Default `message.uploads` to `[]` to keep iterator happy
  - Add Gmail environment variables to cloud-worker app

Test Plan: manual

Reviewers: juan, khamidou, evan

Reviewed By: evan

Differential Revision: https://phab.nylas.com/D3954
This commit is contained in:
Halla Moore 2017-02-16 16:10:49 -08:00
parent 302f3b6215
commit 1e0ae4fb03

View file

@ -60,7 +60,6 @@ class SendmailClient {
throw new APIError('Sending failed - Network Error', 401, {originalError: error})
}
NylasEnv.reportError(error)
throw new APIError('Sending failed', 500, {originalError: error});
}
@ -77,7 +76,8 @@ class SendmailClient {
msgData.messageId = message.headerMessageId;
msgData.attachments = []
for (const upload of message.uploads) {
const uploads = message.uploads || []
for (const upload of uploads) {
msgData.attachments.push({
filename: upload.filename,
content: fs.createReadStream(upload.targetPath),