Haraka plugin that forwards incoming emails to configured Dropbox webhook URLs. Each recipient address can be mapped to a specific Dropbox webhook endpoint in the configuration.
cd /path/to/local/haraka
npm install git@github.com:dspangenberg/haraka-plugin-dropbox.git --legacy-peer-deps
echo "dropbox" >> config/plugins
service haraka restartCopy the config file from the distribution into your Haraka config dir and modify it:
cp node_modules/haraka-plugin-dropbox/config/dropbox.ini config/dropbox.ini
$EDITOR config/dropbox.iniEdit config/dropbox.ini to map recipients to webhook URLs:
[dropboxes]
invoice@dropbox.example.com=https://your-tenant.example.com/invoice@example.com/GYrLasLWEiBeywiDtshilEq5Ztr6HSsy
support@dropbox.example.com=https://your-other-tenant.example.com/invoice@example.com/hrm2sjv4YUGyZFRLJvmSnfUpRUr4kE0UThis plugin sets connection.transaction.notes.discard = true after successfully forwarding an email to a Dropbox webhook. This prevents Haraka from delivering the email to its original recipients.
To use this feature, you must:
- Enable the
queue/discardplugin inconfig/plugins - Configure it to run on the
queuehook
Important: The dropbox plugin must be loaded before other queue plugins in config/plugins. The discard flag is checked during the queue phase, so the queue/discard plugin (and any real queue plugins like queue/smtp) must be listed after dropbox to ensure the flag is respected.
Example config/plugins:
# Load dropbox first - it sets the discard flag after successful webhook delivery
dropbox
# Then load queue plugins - queue/discard checks the discard flag
# and prevents delivery; queue/smtp delivers if discard is not set
queue/discard
queue/smtpThe plugin intercepts emails at the data_post hook and forwards them as JSON payloads to the configured Dropbox webhook URLs. Each email is sent with the following structure:
{
"payload": {
"from": "sender@example.com",
"to": ["recipient@example.com"],
"rcpt_to": "recipient@example.com",
"cc": [],
"bcc": [],
"subject": "Email Subject",
"message_id": "<unique-id@example.com>",
"attachments": [],
"html": "<html>...",
"text": "Plain text body",
"plain_body: "Text body without quotes",
"textAsHtml": "...",
"date": "2024-01-01T00:00:00.000Z",
"references": [],
"in_reply_to": false
}
}