email

Transactional email for Gingee apps using a provider adapter pattern (similar to `db` / `cache`). Configuration (single config, no named profiles): - Optional server defaults: `gingee.json` → `email` - Optional app config: `app.json` → `email` (overrides server for that app) - Runtime override: module:email.sendWithConfig merges on top for one send only Providers (v1): `console` (log only), `sendgrid` (@sendgrid/mail) IMPORTANT: Requires explicit permission to use the module. See docs/permissions-guide for more details.
Description:
  • Transactional email for Gingee apps using a provider adapter pattern (similar to `db` / `cache`). Configuration (single config, no named profiles): - Optional server defaults: `gingee.json` → `email` - Optional app config: `app.json` → `email` (overrides server for that app) - Runtime override: module:email.sendWithConfig merges on top for one send only Providers (v1): `console` (log only), `sendgrid` (@sendgrid/mail) IMPORTANT: Requires explicit permission to use the module. See docs/permissions-guide for more details.

Members

(inner, constant) emailInstances :Map.<string, {adapter: object, config: object}>

Type:
  • Map.<string, {adapter: object, config: object}>

(inner) serverEmailConfig :object|null

Type:
  • object | null

Methods

(static) send(message) → {Promise.<object>}

Description:
  • Sends an email using the app's resolved config (app.json overrides gingee.json).
Example
const email = require('email');
await email.send({
  to: 'user@example.com',
  subject: 'Welcome',
  text: 'Thanks for joining.',
  html: '<p>Thanks for joining.</p>'
});
Parameters:
Name Type Description
message object Outbound message.
Properties
Name Type Attributes Description
to string | Array.<string> Recipient(s).
subject string Subject line.
text string <optional>
Plain-text body.
html string <optional>
HTML body.
from string <optional>
Override default from address for this message only.
fromName string <optional>
Override default from name.
cc string | Array.<string> <optional>
bcc string | Array.<string> <optional>
replyTo string <optional>
attachments Array.<object> <optional>
filename, content (Buffer or base64), type, disposition
Returns:
Result with messageId, provider, status
Type
Promise.<object>

(static) sendWithConfig(configOverride, message) → {Promise.<object>}

Description:
  • Sends a single email using a runtime config that overrides both server and app.json settings for this transaction only. Does not persist or change the app's default adapter.
Example
const email = require('email');
await email.sendWithConfig(
  { type: 'sendgrid', api_key: userApiKey, from: 'billing@example.com' },
  { to: 'customer@example.com', subject: 'Invoice', text: 'Your invoice is attached.' }
);
Parameters:
Name Type Description
configOverride object Partial or full email config (type, api_key, from, from_name, etc.).
message object Same shape as module:email.send.
Returns:
Result with messageId, provider, status
Type
Promise.<object>