Graphrt

Email (SMTP & IMAP)

Send email over SMTP and read, flag and move messages over IMAP (Gmail, Outlook or any provider), with a daily send cap

Beta v0.1.0 Node.js 8 actions ToS risk low
Use in Graphrt Desktop

About

A Graphrt plugin that sends email over SMTP (nodemailer) and reads, flags and moves messages over IMAP (imapflow). It works with any provider that offers SMTP/IMAP login with a password, typically an app password.

What it can do

  • Connection check: verify_connection logs in to SMTP and/or IMAP and logs out. It sends and changes nothing.
  • Sending: send_email takes to/cc/bcc, subject, text and/or html, and reply_to. Use in_reply_to and references for threading. Attachments (workflow nodes only) can come from https URLs or from local files in allowed directories. As an agent tool it only emails recipients in EMAIL_TOOL_ALLOWED_RECIPIENTS.
  • Reading: - list_messages: newest first. Filters: unseen_only, since, from, subject. Each message comes with uid, from/to/cc, subject, date, flags and a 200-character snippet. - read_message: headers, message_id / in_reply_to / references for replies, the body as plain text, and attachment metadata. - list_mailboxes: folders with their special use, and counts when include_counts is set.
  • Organising: mark_seen, mark_unseen and move_message work by UID, at most 100 per call.
  • Every operation is a node email.<operation> and an agent tool. The full reference is in OPERATIONS.md.

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • Verify email connection email.verify_connection
  • Send email email.send_email
  • List email messages email.list_messages
  • Read email message email.read_message
  • List mailboxes email.list_mailboxes
  • Mark email seen email.mark_seen
  • Mark email unseen email.mark_unseen
  • Move email email.move_message

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • EMAIL_PASSWORD (required)
    App password, used for SMTP and IMAP. A node's access_token (from a secret, with --trust-plugin email) overrides it.
  • EMAIL_SMTP_HOST (none)
    SMTP server, needed for sending
  • EMAIL_SMTP_PORT 465
    SMTP port
  • EMAIL_SMTP_SECURE True
    true = implicit TLS (465). false = STARTTLS (587), which is then required, so the password never travels in clear text.
  • EMAIL_SMTP_USER (none)
    SMTP login
  • EMAIL_IMAP_HOST (none)
    IMAP server, needed for reading
  • EMAIL_IMAP_PORT 993
    IMAP port
  • EMAIL_IMAP_SECURE True
    false = STARTTLS, which is then required
  • EMAIL_IMAP_USER EMAIL_SMTP_USER
    IMAP login
  • EMAIL_FROM EMAIL_SMTP_USER
    Sender, e.g. "Toko Budi" <budi@example.com>. Tools cannot change it.
  • EMAIL_DAILY_SEND_LIMIT 200
    Recipients per local day (to + cc + bcc of every attempted message). 0 disables sending.
  • EMAIL_ALLOWED_FILE_DIRS (none)
    Comma-separated directories that local attachments may come from. Leave it unset to allow https URLs only.
  • EMAIL_TOOL_ALLOWED_RECIPIENTS (none)
    Who agents may email with the send_email tool: comma-separated exact addresses and/or @domain entries, case-insensitive, e.g. budi@example.com, @toko.co.id (a domain entry does not cover subdomains). Unset, agent tool calls to send_email are refused. Workflow nodes are not limited by it.
  • EMAIL_STATE_DIR ~/.graphrt/email
    Where the daily send counter is stored (one file per SMTP account)

How to use it

In Graphrt Desktop

  1. Open Plugins and search for Email (SMTP & IMAP).
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install email
workflow.yaml
- id: unread
  type: email.list_messages
  unseen_only: true
  limit: 10
- id: reply
  type: email.send_email
  to: "{{#unread.data.messages.0.from.0.address#}}"
  subject: "Re: {{#unread.data.messages.0.subject#}}"
  text: "Terima kasih, pesanan Anda kami proses."
  in_reply_to: "{{#unread.data.messages.0.message_id#}}"
Plugins in the docs