MCPcopy Index your code
hub / github.com/bdcorps/candymail

github.com/bdcorps/candymail @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
17 symbols 29 edges 8 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

npm David

CandyMail - Email Automation for Node.js

Candymail makes it easy to trigger and send multi-step email sequences in Node.js using a single JSON file. Built for bootstrappers, indie makers with special care.

Features

  1. Portable: Create, share and reuse email marketing strategies between different products
  2. Simple to use: Time to send, subject, body of the emails can all be set up in a single JSON file
  3. Free: No need to pay for monthly Mailchimp etc. payments for email automation plans

Use Cases

  • Build better onboarding by guiding the user through the app with paced training emails
  • Reduce churn by sending exciting community content every few days
  • Convert more customers to paid plans by offering discounts based on the user's usage activity

Installation

Install candymail using yarn:

yarn add --dev candymail

Or npm:

npm install --save-dev candymail

Getting Started

Configuration

Create a candymail.automation.json file on the root level of your project.

Here's a sample:

{
  "automations": [
    {
      "name": "automation1",
      "description": "tell users about pro features",
      "trigger_name": "proplan",
      "emails": [
        {
          "trigger": "time",
          "sendDelay": 1,
          "subject": "Have you tried Feature A?",
          "body": "Feature A will let you do ABC things. Check it out!",
          "from": "abc@gmail.com"
        },
        {
          "trigger": "time",
          "sendDelay": 3,
          "subject": "Try our feature B!",
          "body": "We released feature B just last week and can't wait for you to try it out :)",
          "from": "abc@gmail.com"
        }
      ]
    }
  ]
}

Usage

const path = require('path')
const candymail = require('candymail')

const automationPath = path.resolve('candymail.automation.json')

candymail.init(automationPath, {
  senderEmail: **GMAILEMAIL**,
  senderPassword: **GMAILPASSWORD**
})

candymail.start()

const user = 'howivey729@chatdays.com'
candymail.runAutomation('automation1', user)

console.log('Emails added to queue', candymail.getAllScheduledMessages())

Note: Having problems with Gmail? Enable Allow less secure apps in Google Account settings here.

Notes

  1. Only the hour value will be used in the cron, minutes will be ignored. +1 hour at 11:58 is 12.
  2. Object keys: MM/DD/YYYY:HH. Hours are specified in 24-hour format.
  3. Only GMail with Less Secure Apps turned on.

Got feedback? Hit me up at sunnyashiin@gmail.com

Core symbols most depended-on inside this repo

sendMessagesNow
called by 4
index.js
getConfig
called by 2
src/config.js
generateDateKey
called by 2
src/helper.js
someConditionSatisfiedByUser
called by 1
example/app.js
loadAutomations
called by 1
src/scheduler.js
build
called by 1
src/scheduler.js
addScheduledMessage
called by 1
src/messages.js
getScheduledMessagesAtTime
called by 1
src/messages.js

Shape

Function 17

Languages

TypeScript100%

Modules by API surface

src/scheduler.js4 symbols
src/messages.js4 symbols
index.js4 symbols
src/helper.js2 symbols
src/config.js2 symbols
example/app.js1 symbols

For agents

$ claude mcp add candymail \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact