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.sendWithConfigmerges 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.
- 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:
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
|
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>